Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/coverage-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Upload coverage to Codecov
on:
workflow_run:
workflows: ["Coverage check"]
types:
- completed

jobs:
upload:
name: Upload coverage
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Download coverage artifact
uses: actions/download-artifact@v4
with:
name: coverage-report
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
Comment thread
ahopkins marked this conversation as resolved.
Outdated

- name: Get PR number
id: pr
run: |
if [ "${{ github.event.workflow_run.event }}" == "pull_request" ]; then
PR_NUMBER=$(gh pr list --search "${{ github.event.workflow_run.head_sha }}" --state open --json number --jq '.[0].number')
echo "number=${PR_NUMBER}" >> $GITHUB_OUTPUT
Comment thread
ahopkins marked this conversation as resolved.
Outdated
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
override_commit: ${{ github.event.workflow_run.head_sha }}
override_branch: ${{ github.event.workflow_run.head_branch }}
override_pr: ${{ steps.pr.outputs.number }}
10 changes: 5 additions & 5 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
python-version: "3.11"
tox-env: coverage
ignore-errors: true
- name: Run Codecov
uses: codecov/codecov-action@v3
- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
name: coverage-report
path: ./coverage.xml
retention-days: 1
Comment thread
ahopkins marked this conversation as resolved.
Loading