Skip to content

tests: fix and update pytest workflow. #2

tests: fix and update pytest workflow.

tests: fix and update pytest workflow. #2

Workflow file for this run

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
- name: Upload pytest test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test results (Python ${{ matrix.python-version }})
path: pytest.xml
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/**/*.xml"