Unit tests #768
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: Unit tests | |
on: | |
push: | |
branches: [ development, main ] | |
pull_request: | |
branches: [ development ] | |
schedule: | |
- cron: '0 0 * * 5' | |
jobs: | |
unit-tests: | |
name: "Run unit tests" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
cache: 'poetry' | |
- name: Install dependencies | |
run: poetry install | |
- name: Run unit tests | |
run: > | |
poetry run pytest | |
--junit-xml="output/unit-tests.xml" | |
--cov | |
--cov-report="xml:output/coverage.xml" | |
--cov-report="html:output/htmlcov" | |
- name: Publish test results | |
if: success() || failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-results-${{ matrix.os }}-${{ matrix.python }} | |
path: output/** | |
- name: Upload to Codecov.io | |
if: success() || failure() | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: output/coverage.xml | |
flags: unittests | |
status: | |
if: ${{ always() }} | |
runs-on: ubuntu-latest | |
name: "Unit Test Status" | |
needs: unit-tests | |
steps: | |
- name: Check test matrix status | |
if: ${{ needs.unit-tests.result != 'success' }} | |
run: exit 1 |