Parallel Coverage in CI #216
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
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 | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
python: | |
- version: "3.7" | |
tox-prefix: py37 | |
- version: "3.8" | |
tox-prefix: py38 | |
- version: "3.9" | |
tox-prefix: py39 | |
- version: "3.10" | |
tox-prefix: py310 | |
- version: "3.11" | |
tox-prefix: py311 | |
- version: "3.12" | |
tox-prefix: py312 | |
- version: "pypy3.10" | |
tox-prefix: pypy310 | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python.version }} | |
architecture: x64 | |
- name: Install Dependencies | |
run: | | |
pip install -U pip | |
pip install -U wheel setuptools tox coverage | |
- name: Test | |
run: tox -vv -f ${{ matrix.python.tox-prefix }} -- --cov-report=xml | |
env: | |
TOX_DISCOVER: "patch-for-windows-pypy3" | |
- name: Upload Coverage Artifacts | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1 | |
with: | |
name: coverage-${{ github.job }}-${{ strategy.job-index }} | |
path: ./**/.coverage.* | |
retention-days: 1 | |
- name: Lint | |
run: tox -vv | |
env: | |
TOXENV: lint | |
if: matrix.python.version == 3.9 && matrix.os == 'ubuntu-latest' | |
- name: Docs | |
run: tox -vv | |
env: | |
TOXENV: docs | |
if: matrix.python.version == 3.9 && matrix.os == 'ubuntu-latest' |