Upgrade: Python 3.12 and Migrate Package Management to 'uv' #80
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: | |
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 | |
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: Check types | |
run: | | |
cd back | |
uv pyright 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 }} |