Use uv #129
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: Tests | |
# Trigger the workflow on push or pull request | |
# events but only for the master branch: | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9"] | |
env: | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} with uv | |
uses: drivendataorg/setup-python-uv-action@v1.0.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'packages' | |
- name: Install dependencies | |
run: | | |
uv sync | |
- name: Run tests | |
run: | | |
uv run pytest --cov=./ --cov-report=xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
file: ./coverage.xml | |
env_vars: PYTHON | |
fail_ci_if_error: false | |
linters: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} with uv | |
uses: drivendataorg/setup-python-uv-action@v1.0.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'packages' | |
- name: Install dependencies | |
run: | | |
uv sync | |
- name: Install linter deps | |
run: | | |
uv pip install -r tests/requirements-linters.txt | |
- name: Run isort | |
run: | | |
uv run isort --version | |
uv run isort -c . | |
- name: Run flake8 | |
if: failure() || success() | |
run: | | |
uv run flake8 --version | |
uv run flake8 | |
- uses: psf/black@stable | |
with: | |
version: "22.3.0" | |
if: failure() || success() |