Skip to content

Commit

Permalink
Separate coverage job
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPansino committed Sep 18, 2024
1 parent ea95633 commit 1e7c76a
Showing 1 changed file with 40 additions and 18 deletions.
58 changes: 40 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,40 @@ on:
pull_request:

jobs:
# Combine and upload coverage data
coverage:
if: success() || failure() # Does not run on cancelled workflows
runs-on: ubuntu-latest
needs:
- test-py3

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # 5.1.0
with:
python-version: "3.10"
architecture: x64

- name: Download Coverage Artifacts
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # 4.1.4
with:
path: ./

- name: Combine Coverage
run: |
pip install coverage
find . -name ".coverage.*" -exec mv {} ./ \;
coverage combine
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # 4.3.0
with:
files: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

# Tests
test-py3:
strategy:
fail-fast: False
Expand Down Expand Up @@ -51,25 +85,13 @@ jobs:
env:
TOX_DISCOVER: "patch-for-windows-pypy3"

- name: Combine Coverage
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
coverage combine ./.tox/*/.coverage.*
elif [[ "$RUNNER_OS" == "Windows" ]]; then
coverage combine .\\.tox\\*\\.coverage.*
else
exit 1
fi
coverage xml
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v1
- name: Upload Coverage Artifacts
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
with:
files: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
name: coverage-${{ github.job }}-${{ strategy.job-index }}
path: ./**/.coverage.*
retention-days: 1

- name: Lint
run: tox -vv
env:
Expand Down

0 comments on commit 1e7c76a

Please sign in to comment.