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
name: rust
on:
push:
branches:
pull_request:
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
jobs:
# homelab-1 has a dedicated repository-scoped validation runner, so separate Linux jobs would only
# serialize while repeating checkout, cache and toolchain setup. Keep the
# complete Linux gate in one allocation; macOS remains independent below.
linux:
# Preserve the required check name across the host move.
name: validate (ai-1)
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: rustfmt, clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
# Its default save cleanup deletes every Cargo binary present when
# the action starts. These runners own pinned publisher tools.
cache-bin: false
- name: Format
run: cargo fmt --all --check
# Lint levels come from [lints] in Cargo.toml, not from flags here.
- name: Clippy
run: cargo clippy --all-targets --all-features
# Clippy does not run rustdoc's lints, and most modules are private, so only a private-items build sees a broken intra-doc link. [lints] denies its warnings too.
- name: Rustdoc
run: cargo doc --no-deps --all-features --document-private-items
- name: Test
run: cargo test --all-targets --all-features
# If this breaks, the MSRV in Cargo.toml is wrong - do not paper over it
# by bumping the toolchain here. It has moved once already: `ignore`
# 0.4.30 raised the real floor to 1.88 while open-agent-sdk still asks
# for 1.85, and declares no `rust-version`, so the first sign was a
# compile error in a dependency.
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: 1.88.0
# No --all-targets: MSRV is a property of [dependencies]. Whether the dev
# dependencies build on 1.88 has no consumer.
- name: MSRV
run: cargo +1.88.0 check
test-macos:
name: test (Mac mini)
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
runs-on:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: clippy
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
with:
cache-bin: false
- run: cargo test --all-targets --all-features
# Exhaustive mutation is scheduled separately. A trusted main push or a pull request from this repository's own branches gets fast feedback on only the production code it changes, after both validation lanes pass. Forked pull requests never reach the self-hosted runner.
mutants-diff:
# Preserve the required check name across the host move.
name: mutate diff (ai-1)
needs:
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on:
timeout-minutes: 120
# Only a pull request's newest head matters, so a push to it cancels the run it supersedes. Every main push keeps its own run, since each mutates a different diff.
concurrency:
group: mutants-diff-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
# A pull request mutates its head commit, not GitHub's merge commit: cargo-mutants refuses a diff whose new side does not match the tree it mutates. A push has no pull_request object and falls back to its own before and after SHAs.
env:
DIFF_BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
DIFF_HEAD: ${{ github.event.pull_request.head.sha || github.sha }}
steps:
# cargo-mutants builds every mutant in its own scratch copy of the tree, which excludes target/, so an ordinary clean checkout loses nothing.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ env.DIFF_HEAD }}
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: stable
components: clippy
- uses: taiki-e/install-action@f7e5d7c961414b23f5b25b2da9294395d08513ad # v2.87.26
with:
tool: cargo-mutants@27.1.0
# Three dots diff from the merge base, so a pull request's diff holds only its own changes after its base branch moves on. An empty end would read as HEAD and yield an empty diff, which cargo-mutants passes.
- name: Materialize diff
shell: bash
run: |
set -euo pipefail
: "${DIFF_BASE:?}" "${DIFF_HEAD:?}"
git diff --no-ext-diff --unified=0 "$DIFF_BASE...$DIFF_HEAD" > "$RUNNER_TEMP/changes.diff"
- run: ./scripts/mutants-run.sh --in-diff "$RUNNER_TEMP/changes.diff"