tests #147
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-dependency-glob: | | |
pyproject.toml | |
- name: Lint package | |
run: | | |
uv run --group lint just lint | |
- name: Typecheck package | |
run: | | |
uv run --group typecheck --all-extras 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.8, 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: Install zip on Windows | |
if: matrix.os == 'windows-latest' | |
run: | | |
choco install zip | |
- name: Run tests | |
run: | | |
just python=${{ matrix.python-version }} test -vv | |
- name: Upload coverage to codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: ${{ (github.event_name == 'push' && true) || (github.event_name == 'pull_request' && true) || false }} | |
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 }} |