fix: add coverage comment
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

This commit was merged in pull request #121.
This commit is contained in:
2026-08-03 14:30:58 +02:00
parent 28dec7a3fe
commit 8def022d4c
+59 -8
View File
@@ -16,7 +16,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v5
uses: https://github.com/actions/checkout@v5
with:
fetch-depth: 0
@@ -38,7 +38,7 @@ jobs:
ruff check
- name: Checkout pyright diff plugin
uses: actions/checkout@v5
uses: https://github.com/actions/checkout@v5
with:
repository: mx/diff_quality_basedpyright
path: diff_quality_basedpyright
@@ -51,14 +51,13 @@ jobs:
test:
runs-on: ubuntu-latest
needs: "lint"
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout code
uses: actions/checkout@v5
uses: https://github.com/actions/checkout@v5
- name: Setup
uses: ./.gitea/actions/install
@@ -77,14 +76,13 @@ jobs:
test-with-beamline-plugins:
runs-on: ubuntu-latest
needs: ["lint", "test"]
strategy:
matrix:
plugin_repo: ["pxi_bec", "pxii_bec", "pxiii_bec"]
steps:
- name: Checkout code
uses: actions/checkout@v5
uses: https://github.com/actions/checkout@v5
- name: Setup
uses: ./.gitea/actions/install
@@ -111,11 +109,10 @@ jobs:
test-with-coverage:
runs-on: ubuntu-latest
needs: ["lint", "test", "test-with-beamline-plugins"]
steps:
- name: Checkout code
uses: actions/checkout@v5
uses: https://github.com/actions/checkout@v5
- name: Setup
uses: ./.gitea/actions/install
@@ -131,3 +128,57 @@ jobs:
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