-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (115 loc) · 4.49 KB
/
Copy pathci.yml
File metadata and controls
138 lines (115 loc) · 4.49 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version-file: "pyproject.toml"
- name: Install linting tools only
# Pin to the ruff resolved in uv.lock so CI checks the same formatting
# `uv run ruff` applies locally. Unpinned, any ruff release can fail
# lint on unrelated PRs -- 0.16.0 started formatting Python code blocks
# inside Markdown, which reformats 11 docs/ and dev-notes/ files.
run: |
RUFF_VERSION=$(python -c "
import tomllib
lock = tomllib.load(open('uv.lock', 'rb'))
print(next(p['version'] for p in lock['package'] if p['name'] == 'ruff'))
")
echo "Pinning ruff==${RUFF_VERSION} (from uv.lock)"
uv pip install --system "ruff==${RUFF_VERSION}"
- name: Run ruff format check
run: ruff format --check --exclude vulture_whitelist.py .
- name: Run ruff lint
run: ruff check --exclude vulture_whitelist.py .
- name: Run type check
run: uvx ty check src/leech/
rust-lint:
name: Rust lint (fmt + clippy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Install Rust toolchain (rustfmt + clippy)
run: rustup component add rustfmt clippy
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: rustfmt
run: cargo fmt --manifest-path rust/Cargo.toml --check
- name: clippy
run: cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
test:
name: Test - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
# Cache the leech_core build. The bulk of the test job is compiling
# arrow + escapepod-signal + leech_core via maturin; caching target/ and
# the cargo registry cuts that from minutes to seconds on unchanged deps.
- name: Cache Rust build
uses: Swatinem/rust-cache@v2
with:
workspaces: rust
- name: Install dependencies
env:
# GPU-less runner: install the CPU-only torch wheel so uv doesn't pull
# the multi-GB CUDA stack (nvidia-cu13-*). `uv sync` installs the locked
# CUDA torch regardless of this, so we install via `uv pip install`,
# which honors --torch-backend. The lock (and local/cluster GPU installs
# via `uv sync`) are unchanged.
UV_TORCH_BACKEND: cpu
run: |
uv venv
# Only the test runner + runtime deps are needed here — no lint/type
# tooling (that's the Lint job) and no pipeline/notebook extras (tests
# don't import snakemake/plotnine). Full install (Rust extension +
# escapepod); fall back without the Rust extension (leech_core) but keep
# escapepod (a PyPI wheel), which leech imports unconditionally.
# `onnx` is here so the export round-trip tests actually RUN rather
# than skipping: they compare onnxruntime against torch across the
# serialization boundary, which is the check an in-process assert
# cannot make.
uv pip install --torch-backend=cpu -e ".[test,rust,pod5,onnx]" \
|| uv pip install --torch-backend=cpu -e ".[test,pod5,onnx]"
- name: Run tests
env:
UV_TORCH_BACKEND: cpu
# --no-sync: don't let `uv run` re-sync the env to the CUDA-pinned lock.
run: uv run --no-sync pytest --cov=leech --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v7
if: matrix.python-version == '3.12'
with:
files: ./coverage.xml
fail_ci_if_error: false