-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (37 loc) · 1.32 KB
/
python-ci.yml
File metadata and controls
47 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
name: Python CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Install uv and set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5 # Use the latest version or pin a specific one e.g., v1.1.1
with:
python-version: ${{ matrix.python-version }}
# Enable caching, invalidating if pyproject.toml changes
enable-cache: true
cache-dependency-glob: "pyproject.toml" # Or "uv.lock" if you commit it
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Install project in editable mode
# Install the current project (`.`) in editable mode (`-e`).
# `--no-deps` prevents reinstalling dependencies already handled by `uv sync`.
run: uv pip install --no-deps -e .
- name: Lint with Ruff
run: uvx ruff check .
- name: Format with Ruff
run: uvx ruff format --check .
- name: Type check with ty
run: uvx ty check
- name: Test with pytest
run: uv run pytest