Update README.md #43
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' | |
jobs: | |
clean: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Install tox and any other packages | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
pip install pytest | |
pip install pytest-cov | |
- name: Run tox | |
run: tox -e clean | |
test: | |
runs-on: ubuntu-latest | |
needs: clean | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- python: '3.10' | |
tox: 'py310' | |
- python: 3.11 | |
tox: 'py311' | |
- python: 3.12 | |
tox: 'py312' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install tox and any other packages | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
pip install pytest | |
pip install pytest-cov | |
- name: Run tox | |
run: tox -e ${{ matrix.tox }} | |
- name: Upload .coverage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage.${{ matrix.tox }} | |
path: .coverage.${{ matrix.tox }} | |
report: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Download coverage for Python 3.10 | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage.py310 | |
path: .coverage.py310 | |
- name: Download coverage for Python 3.11 | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage.py311 | |
path: .coverage.py311 | |
- name: Download coverage for Python 3.12 | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage.py312 | |
path: .coverage.py312 | |
- name: Install tox and any other packages | |
run: | | |
pip install --upgrade pip | |
pip install tox | |
pip install pytest | |
pip install pytest-cov | |
- name: Combine coverages and generate reports | |
run: | | |
coverage combine .coverage.py310 .coverage.py311 .coverage.py312 | |
coverage report | |
coverage xml | |
coverage html | |
- name: Upload htmlcov artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage_report | |
path: htmlcov/ | |
- name: Upload .coverage artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: .coverage | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |