Repository navigation
105 lines (97 loc) · 3.5 KB
/
Copy pathci.yml
File metadata and controls
105 lines (97 loc) · 3.5 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: CI
on:
pull_request:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
# Both syncing jobs install this EXACT set, so they share one warm uv cache instead of
# racing to save mutually-useless ones. See the `ci` group in pyproject.toml.
SYNC_ARGS: --no-default-groups --group ci --extra cli --extra qc --extra log
jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
# Ruff runs standalone: `ruff check` measures 0s, so a full `uv sync` in front of it was
# ~40s of pure overhead. `version-file` reads the resolved pin (0.15.12) out of uv.lock,
# which is the same version .pre-commit-config.yaml pins, so local and CI cannot drift.
- name: Ruff lint
uses: astral-sh/ruff-action@v4.1.0
with:
version-file: uv.lock
args: check --output-format=github
- name: Ruff format check
uses: astral-sh/ruff-action@v4.1.0
with:
version-file: uv.lock
args: format --check
python-type:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.0.0
with:
python-version: "3.13"
enable-cache: true
# `prune-cache` is NOT on by default; without it the saved cache carries both the
# zipped and unzipped copy of every wheel, which matters a lot with the qc extra.
prune-cache: true
cache-suffix: ci-cli-qc
- name: Sync dependencies
run: uv sync --frozen ${{ env.SYNC_ARGS }}
- name: Pyright
run: uv run pyright
# Deliberately NOT sharded across a matrix. Measured on this repo: ~21s of every pytest
# run is fixed overhead (interpreter start, imports, xdist workers, coverage init) against
# only ~15s of actual test execution, so a 4-way split saved ~12s of test time while the
# slowest-of-four sync straggler plus a coverage-combine job cost ~20s more than it saved.
python-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Install uv
uses: astral-sh/setup-uv@v10.0.0
with:
python-version: "3.13"
enable-cache: true
prune-cache: true
cache-suffix: ci-cli-qc
- name: Sync dependencies
run: uv sync --frozen ${{ env.SYNC_ARGS }}
- name: Build Rust extension
run: uv run maturin develop --manifest-path rust/Cargo.toml
# `-n auto` comes from the pyproject addopts; coverage is reported inline.
- name: Run tests
run: uv run pytest
rust:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Cargo fmt
run: cargo fmt --check --manifest-path rust/Cargo.toml
- name: Cargo clippy
run: cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
- name: Cargo test
run: cargo test --manifest-path rust/Cargo.toml