github: minor enhancements to workflows. #5
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: Test package with pytest | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
pytest: | |
name: Run tests | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
# 3.9 was removed from this matrix due to an issue with the test framework. | |
# This is not worth investigating more since it will be unsupported "soon". | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install testing dependencies | |
run: make install-testing | |
- name: PyTest | |
run: pytest --cov=aio_ld2410 -v -s --junit-xml=pytest.xml --cov-report=term --cov-report=xml | |
- name: Upload pytest test results | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: Test results (Python ${{ matrix.python-version }}) | |
path: pytest.xml | |
- name: Upload coverage results | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: Coverage results (Python ${{ matrix.python-version }}) | |
path: coverage.xml | |
- name: Publish coverage results to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
name: Coverage with Python ${{ matrix.python-version }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env_vars: PYTHON | |
file: ./coverage.xml | |
disable_search: true | |
flags: unittests | |
publish-pytest: | |
name: Publish tests results | |
needs: | |
- pytest | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
if: success() || failure() | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "artifacts/**/pytest.xml" |