Skip to content

feat(cli): leech model train-crf #721

feat(cli): leech model train-crf

feat(cli): leech model train-crf #721

Workflow file for this run

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