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
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# Many color libraries just need this variable to be set to any value.
FORCE_COLOR: 3
CARGO_TERM_COLOR: always
jobs:
lint:
name: Lint & format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v7
# ty type-checks against installed deps (numpy, astropy, ...), so build
# the extension and populate .venv first; ty auto-discovers ./.venv.
- name: Build extension and install deps
run: uv sync --extra test --extra dev
# Single source of truth: the same hooks developers run locally
# (.pre-commit-config.yaml) — ruff, ty, cargo fmt, clippy. prek exits
# nonzero if any autofix hook had to change a file, so this fails CI
# exactly like the `--check` variants did.
- name: prek (lint, format, type check)
run: uvx prek run --all-files --show-diff-on-failure
docs:
name: Docs build
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v6
# Rust is needed twice: maturin builds the extension during `uv sync`,
# and sphinxcontrib-programoutput runs `cargo run -- --help` to embed
# the CLI help text.
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v7
- name: Build extension and install docs dependencies
run: uv sync --group docs
# -W makes warnings fatal. The quickstart notebook is re-executed and
# the CLI help regenerated on every build, so stale or broken examples
# fail here.
- name: Build docs
run: uv run --no-sync sphinx-build -W -b html docs docs/_build/html
rust-test:
name: Rust tests
runs-on: ubuntu-latest
needs:
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run Rust tests
# The integration tests exercise the pure-Rust API; no Python features.
run: cargo test
python-test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs:
strategy:
fail-fast: false
matrix:
python-version:
steps:
- uses: actions/checkout@v6
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
# Builds the maturin extension module and installs the `test` extra
# (pytest, radio-beam, astropy). cfitsio is compiled from source via the
# crate's `fitsio-src` feature, so no system library is needed.
- name: Build extension and install test dependencies
run: uv sync --extra test
- name: Run pytest
run: uv run --no-sync pytest -ra --durations=20