tests #65
This file contains hidden or 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] | |
pull_request: | |
schedule: | |
# Run every Sunday | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
code-quality: | |
name: Code quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v2 | |
- uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-suffix: "dev" | |
cache-dependency-glob: | | |
uv.lock | |
- name: Lint package | |
run: | | |
just lint | |
- name: Type check | |
run: | | |
just typecheck | |
tests: | |
name: "Tests (${{ matrix.os }}, Python ${{ matrix.python-version }})" | |
needs: code-quality | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: extractions/setup-just@v2 | |
- uses: astral-sh/setup-uv@v5 | |
with: | |
enable-cache: true | |
cache-suffix: "tests-${{ matrix.python-version }}" | |
cache-dependency-glob: | | |
pyproject.toml | |
- name: Run tests | |
run: | | |
just python=${{ matrix.python-version }} test | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
fail_ci_if_error: ${{ (github.event_name == 'push' && true) || (github.event_name == 'pull_request' && true) || false }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
notify: | |
name: Notify failed build | |
needs: [code-quality, tests] | |
if: failure() && (github.event_name == 'push' || github.event_name == 'schedule') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: jayqi/failed-build-issue-action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |