Skip to content

Tests

Tests #60

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
branches: [ "*" ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10','3.11','3.12']
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v4
- name: Set up hatch
uses: ./.github/actions/setup-hatch
with:
python-version: ${{ matrix.python-version }}
- name: Set up PortAudio
uses: ./.github/actions/setup-portaudio
with:
os: ${{ matrix.os }}
- name: Check import
run: hatch -v run +py=${{ matrix.python-version }} tests:import
- name: Check demo
run: hatch -v run +py=${{ matrix.python-version }} tests:demo
- name: Run unittests
run: hatch -v run +py=${{ matrix.python-version }} tests:test
- name: Run doctests
run: hatch -v run +py=${{ matrix.python-version }} tests:doctest
coverage:
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v4
- name: Set up hatch
uses: ./.github/actions/setup-hatch
- name: Set up PortAudio
uses: ./.github/actions/setup-portaudio
- name: Generate coverage report
run: hatch -v run +py=3.12 tests:coverage
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: upload coverage HTML report
path: htmlcov
alls-green:
name: Tests green?
if: always()
needs:
- tests
- coverage
runs-on: ubuntu-latest
steps:
- id: workaround
uses: actions/github-script@v7
with:
# Workaround for https://github.com/re-actors/alls-green/issues/29
# we strip outputs from the needs object to avoid nested JSON
result-encoding: string
script: |
return JSON.stringify(Object.fromEntries(Object.entries(${{ toJSON(needs) }})
.map(([name, { result }]) => [name, { result, outputs: {} }])));
- name: All checks passed?
uses: re-actors/[email protected]
with:
jobs: ${{ steps.workaround.outputs.result }}