Massive refactor #97
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: Test | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
test: | |
env: | |
UV_CACHE_DIR: /tmp/.uv-cache | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.12" | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up uv | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Set up uv | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: irm https://astral.sh/uv/install.ps1 | iex | |
shell: powershell | |
- name: Set up Python ${{ matrix.python-version }} | |
run: uv python install ${{ matrix.python-version }} | |
- name: Restore uv cache | |
uses: actions/cache@v4 | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' }} | |
with: | |
path: /tmp/.uv-cache | |
key: uv-${{ runner.os }}-${{ hashFiles('back/uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-${{ hashFiles('back/uv.lock') }} | |
uv-${{ runner.os }} | |
- name: Install the project dependencies | |
run: | | |
cd back | |
uv sync --all-extras --dev | |
- name: Lint | |
run: | | |
cd back | |
uv run ruff check src tests | |
- name: "Create cache key for documentation" | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: echo "$PWD/back/.venv/bin" >> $GITHUB_PATH | |
- name: Check types | |
uses: jakebailey/pyright-action@v2 | |
with: | |
working-directory: back/ | |
extra-args: src | |
- name: Run tests | |
run: | | |
cd back | |
uv run pytest --cov=src/whombat --cov-report=xml -n auto | |
- name: Upload coverage reports to Codecov | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
uses: codecov/codecov-action@v4 | |
env: | |
files: back/coverage.xml | |
fail_ci_if_error: true | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Minimize uv cache | |
run: uv cache prune --ci |