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
name: CI
permissions:
contents: read
on:
push:
branches:
pull_request:
branches:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
# Incremental artifacts are per-machine rebuild state, useless to a fresh
# runner, so they stay disabled rather than bloating the restored cache.
CARGO_INCREMENTAL: 0
jobs:
test:
name: Test / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- uses: ./.github/actions/setup-linux-deps
if: runner.os == 'Linux'
- uses: taiki-e/install-action@nextest
# `tests/doctor_json.rs` is the `water doctor --json` smoke; nextest
# runs it with everything else.
- run: cargo nextest run --locked --profile ci
lint:
# Most of this crate is behind `cfg(target_os = ...)`: the Apple backend,
# the Windows toolchain and process plumbing. Linting on one OS leaves all
# of it unlinted — `cargo nextest` compiles it on the other runners, so a
# compile error surfaces, but a clippy finding never does. Lint where the
# code is.
name: Lint / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
with:
components: clippy, rustfmt
- uses: ./.github/actions/setup-linux-deps
if: runner.os == 'Linux'
- run: cargo fmt --check
if: runner.os == 'Linux'
- run: cargo clippy --all-targets -- -D warnings
no-default-features:
name: Check / no default features
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-rust
- run: cargo check --no-default-features --all-targets
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Installing the toolchain is not the same as building with it.
# `dtolnay/rust-toolchain` only sets the rustup default, and this
# repository's `rust-toolchain.toml` overrides the default for every
# cargo invocation inside the checkout — so this job compiled on
# `stable` and proved nothing about the declared floor. `RUSTUP_TOOLCHAIN`
# is the one override that beats the file.
- name: Read rust-version from Cargo.toml
id: msrv
shell: bash
run: |
set -euo pipefail
version="$(sed -n 's/^rust-version = "\(.*\)"/\1/p' Cargo.toml)"
if [ -z "$version" ]; then
echo "::error::Cargo.toml declares no rust-version"
exit 1
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "RUSTUP_TOOLCHAIN=$version" >> "$GITHUB_ENV"
- uses: ./.github/actions/setup-rust
with:
toolchain: ${{ steps.msrv.outputs.version }}
cache: "false"
- uses: ./.github/actions/setup-linux-deps
# Proof in the log that the floor is what compiled, so a future change
# to the pin or the action cannot quietly turn this back into a second
# stable run.
- name: Show the toolchain this job builds with
run: rustc --version && cargo --version
# The shipped artifact is what MSRV bounds: dev-dependencies may
# legitimately require newer, so check the package targets only.
- run: cargo check --locked