Skip to content

Commit

Permalink
Merge pull request #452 from rackerlabs/fix-coverage
Browse files Browse the repository at this point in the history
ci: split up code coverage reporting to support forks
  • Loading branch information
mfencik authored Nov 11, 2024
2 parents cf9c87b + ce9fdad commit 55b37ce
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/code-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ concurrency:

jobs:
python:
permissions:
contents: read
pull-requests: write

runs-on: ubuntu-latest

strategy:
Expand All @@ -48,7 +44,24 @@ jobs:
- run: poetry install --sync --with test
- run: poetry build
- run: "poetry run pytest --cov --cov-report xml:coverage.xml"
- uses: orgoro/coverage@3f13a558c5af7376496aa4848bf0224aead366ac # v3.2
- uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.project }}
path: python/${{ matrix.project }}/coverage.xml
retention-days: 1

coverage-upload:
needs: python
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: coverage-*
merge-multiple: true
- run: |
npx cobertura-merge-globby -o output.xml --files=python/**/coverage.xml
- uses: actions/upload-artifact@v4
with:
coverageFile: python/${{ matrix.project }}/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
name: coverage.xml
path: coverage.xml
retention-days: 1
27 changes: 27 additions & 0 deletions .github/workflows/coverage-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Coverage Report

on:
workflow_run:
workflows: ["code tests"]
types:
- completed

permissions:
actions: read
contents: read
pull-requests: write

jobs:
coverage-report:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/download-artifact@v4
with:
name: coverage.xml
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: orgoro/coverage@3f13a558c5af7376496aa4848bf0224aead366ac # v3.2
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 55b37ce

Please sign in to comment.