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
name: CI
on:
push:
branches:
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# `sim` implies `alg` implies `aux`: the widest non-GPU, non-HDF5 build.
# `cuda` / `metal` need hardware a hosted runner does not have.
FEATURES: sim
jobs:
# fmt and clippy are PINNED to the toolchain this crate is developed on,
# not floating on `stable`: a new rustfmt can reformat code it used to
# accept and a new clippy can add lints, so `--check` / `-D warnings` on a
# floating toolchain turns main red with no code change. Bumping the pin
# is a deliberate PR that carries the new version's lint fixes with it.
fmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.94
with:
components: rustfmt
- run: cargo fmt --all --check
clippy:
name: clippy (-D warnings)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/system-deps
- uses: dtolnay/rust-toolchain@1.94
with:
components: clippy
- uses: Swatinem/rust-cache@v2
# --all-targets so test and bench code is linted too.
- run: cargo clippy --all-targets --features "$FEATURES" -- -D warnings
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/system-deps
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --features "$FEATURES"
# The HDF5 backend is opt-in, so a plain build never touches its
# `#[cfg(feature = "hdf5")]` code and it can rot indefinitely. This is the
# one optional feature a hosted runner can satisfy. Also check the feature
# ladder below `sim`, since downstream crates enable subsets.
features:
name: check --features hdf5 and feature subsets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/system-deps
with:
hdf5: 'true'
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: |
for f in hdf5 sim,hdf5 "" alg; do
echo "::group::--features '$f'"
cargo check --all-targets --features "$f"
echo "::endgroup::"
done
# `rust-version` is the highest `rust-version` among resolved dependencies
# (1.91, from the zarrs stack). That is the floor the dependency graph
# imposes; this job checks whether this crate's own sources also build
# there. Non-blocking until it has gone green once -- then delete
# `continue-on-error` to make it a gate.
msrv:
name: MSRV (discovery, non-blocking)
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/system-deps
- uses: dtolnay/rust-toolchain@1.91
- uses: Swatinem/rust-cache@v2
- run: cargo check --features "$FEATURES"