CI / test (3.11) (pull_request) Successful in 48s
CI / test (3.13) (pull_request) Successful in 48s
CI / test (3.12) (pull_request) Successful in 53s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 59s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 56s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m12s
CI / test-with-coverage (pull_request) Successful in 1m15s
CI / coverage-analysis (pull_request) Successful in 18s
CI / lint (pull_request) Successful in 3m34s
CI / lint (push) Successful in 32s
CI / test (3.11) (push) Canceled after 40s
CI / test (3.12) (push) Canceled after 36s
CI / test (3.13) (push) Canceled after 35s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 31s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 30s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 27s
CI / test-with-coverage (push) Canceled after 25s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 31s
185 lines
5.0 KiB
YAML
185 lines
5.0 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup
|
|
uses: ./.gitea/actions/install
|
|
with:
|
|
python_version: "3.12"
|
|
index_username: ${{ secrets.GITEA_USER }}
|
|
index_password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Format
|
|
run: |
|
|
source .venv/bin/activate
|
|
ruff format --check
|
|
|
|
- name: Lint
|
|
run: |
|
|
source .venv/bin/activate
|
|
ruff check
|
|
|
|
- name: Checkout pyright diff plugin
|
|
uses: https://github.com/actions/checkout@v5
|
|
with:
|
|
repository: mx/diff_quality_basedpyright
|
|
path: diff_quality_basedpyright
|
|
|
|
- name: Typecheck Diff
|
|
run: |
|
|
source .venv/bin/activate
|
|
uv pip install -e diff_quality_basedpyright
|
|
diff-quality --violations=basedpyright
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: ["3.11", "3.12", "3.13"]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v5
|
|
|
|
- name: Setup
|
|
uses: ./.gitea/actions/install
|
|
with:
|
|
python_version: ${{ matrix.python-version }}
|
|
index_username: ${{ secrets.GITEA_USER }}
|
|
index_password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Run Pytest
|
|
env:
|
|
QT_QPA_PLATFORM: offscreen
|
|
BEAMLINE: SIMULATED
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest ./tests/unit
|
|
|
|
test-with-beamline-plugins:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
plugin_repo: ["pxi_bec", "pxii_bec", "pxiii_bec"]
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v5
|
|
|
|
- name: Setup
|
|
uses: ./.gitea/actions/install
|
|
with:
|
|
python_version: "3.12"
|
|
index_username: ${{ secrets.GITEA_USER }}
|
|
index_password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Install beamline plugin
|
|
run: |
|
|
source .venv/bin/activate
|
|
git clone https://gitea.psi.ch/bec/mx_bec.git
|
|
git clone https://gitea.psi.ch/bec/${{ matrix.plugin_repo }}.git
|
|
uv pip install -e ./mx_bec
|
|
uv pip install -e ./${{ matrix.plugin_repo }}
|
|
|
|
- name: Run Pytest
|
|
env:
|
|
QT_QPA_PLATFORM: offscreen
|
|
BEAMLINE: SIMULATED
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest ./tests/unit
|
|
|
|
test-with-coverage:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://github.com/actions/checkout@v5
|
|
|
|
- name: Setup
|
|
uses: ./.gitea/actions/install
|
|
with:
|
|
python_version: "3.12"
|
|
index_username: ${{ secrets.GITEA_USER }}
|
|
index_password: ${{ secrets.GITEA_TOKEN }}
|
|
|
|
- name: Run Pytest with Coverage
|
|
env:
|
|
QT_QPA_PLATFORM: offscreen
|
|
BEAMLINE: SIMULATED
|
|
run: |
|
|
source .venv/bin/activate
|
|
pytest --cov=aare --cov-config=./pyproject.toml --cov-branch --cov-report=xml --no-cov-on-fail ./tests/unit
|
|
|
|
- name: Build coverage summary
|
|
run: |
|
|
source .venv/bin/activate
|
|
{
|
|
echo "<!-- coverage-report -->"
|
|
echo "### Coverage report"
|
|
echo
|
|
echo "**Total line + branch coverage: $(coverage report --format=total)%**"
|
|
echo
|
|
echo "<details><summary>Per-file breakdown</summary>"
|
|
echo
|
|
coverage report --format=markdown
|
|
echo
|
|
echo "</details>"
|
|
} > coverage-summary.md
|
|
|
|
# Only the rendered summary is uploaded. coverage.xml (~1 MB) is rejected
|
|
# with an HTML 403 by the proxy in front of gitea.psi.ch.
|
|
- name: Upload coverage
|
|
uses: https://github.com/actions/upload-artifact@v3
|
|
with:
|
|
name: coverage
|
|
path: coverage-summary.md
|
|
if-no-files-found: error
|
|
|
|
coverage-analysis:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
issues: write
|
|
pull-requests: write
|
|
needs: ["test-with-coverage"]
|
|
if: github.event_name == 'pull_request'
|
|
steps:
|
|
- name: Download coverage
|
|
uses: https://github.com/actions/download-artifact@v3
|
|
with:
|
|
name: coverage
|
|
|
|
- name: Find Comment
|
|
uses: https://github.com/peter-evans/find-comment@v3
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-author: "github-actions[bot]"
|
|
body-includes: "<!-- coverage-report -->"
|
|
|
|
- name: Create or update comment
|
|
uses: https://github.com/peter-evans/create-or-update-comment@v5
|
|
with:
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
body-path: coverage-summary.md
|
|
edit-mode: replace
|