-
Notifications
You must be signed in to change notification settings - Fork 232
235 lines (202 loc) · 7.61 KB
/
Copy pathci.yaml
File metadata and controls
235 lines (202 loc) · 7.61 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: ci
# Runner versions are pinned to avoid surprise breaking changes from -latest migrations.
# The tend-weekly workflow checks for updates and opens bump PRs (see
# .claude/skills/running-tend/SKILL.md → "Weekly Maintenance: CI Pin Bumps").
# - windows-2022: Pinned because windows-2025 lacks D: drive (actions/runner-images#12677)
# - ubuntu-24.04, macos-15: Pinned to current -latest equivalents
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
# CI does clean builds, so incremental compilation tracking adds I/O overhead
# with no benefit. Especially impactful on Windows where I/O is the bottleneck.
CARGO_INCREMENTAL: 0
RUSTFLAGS: -C debuginfo=0
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- name: 💰 Cache
uses: Swatinem/rust-cache@v2
with:
# Own cache (clippy builds check artifacts the shared test cache can't
# supply), gated to main so PRs restore but never write.
cache-bin: "false"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: 🔍 Pre-commit hooks
uses: pre-commit/action@v3.0.1
feature-check:
# Guards the library/CLI cleave: the `cli` feature gates clap, skim,
# crossterm, termimad, env_logger, humantime. If anything reachable from
# `pub mod` in src/lib.rs starts using one of those crates, library
# consumers (e.g. worktrunk-sync) would silently regain the transitive
# dependency graph. These checks fail before that can ship.
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- name: 💰 Cache
uses: Swatinem/rust-cache@v2
with:
# Own cache (its `--no-default-features` builds want a smaller dep set
# than the shared test cache), gated to main.
cache-bin: "false"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Library builds without any features
run: cargo check --lib --no-default-features
- name: Library builds with syntax-highlighting only
run: cargo check --lib --no-default-features --features syntax-highlighting
- name: Binary builds without syntax-highlighting
run: cargo check --bin wt --no-default-features --features cli
test:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
name: linux
- os: macos-15
name: macos
- os: windows-2022
name: windows
name: test (${{ matrix.name }})
runs-on: ${{ matrix.os }}
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- uses: ./.github/actions/test-setup
- name: Install wt
uses: baptiste0928/cargo-install@v3
with:
crate: worktrunk
version: "=0.72.0"
- name: "Use fast D: drive for temp files (Windows)"
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "D:\tmp" | Out-Null
echo "TEMP=D:\tmp" >> $env:GITHUB_ENV
echo "TMP=D:\tmp" >> $env:GITHUB_ENV
# The full nextest suite (snapshots included) — CI's long-pole. The fast
# pre-merge gates (lockfile/doctest/rustdoc) live in the `fast-checks` job,
# so this job is now just the suite and can later be swapped for the
# cargo-affected legs on PRs without disturbing those gates. The `insta`
# step runs `--unreferenced reject` on Linux (orphan-snapshot detection) —
# an intrinsically full-suite check that rides this job on push-to-main and,
# after the flip, stays there.
- name: 🧪 Full test suite
run: wt hook pre-merge --yes insta
# Anything tests leave behind in the working tree is a leak we want to see
# before it lands. `target/` is gitignored, so a normal run is clean —
# untracked files here mean a test wrote outside its sandbox (the
# `default_*.profraw` stray that prompted this guard is the canonical case).
- name: 🧹 Verify clean working tree
shell: bash
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error::tests left files behind in the working tree:"
git status --porcelain
exit 1
fi
- name: 📊 Upload test timing
if: always()
uses: actions/upload-artifact@v7
with:
name: junit-${{ matrix.name }}
path: target/nextest/default/junit.xml
- name: 📊 Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v7.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: target/nextest/default/junit.xml
report_type: test_results
# The pre-merge gates that aren't the nextest suite: Cargo.lock freshness,
# doctests, and the rustdoc `-Dwarnings` build. Split out of `test` so the
# full suite (the long-pole) can later be replaced on PRs by the
# cargo-affected legs without dropping these — they stay required and
# untouched by that flip. Linux-only: all three are platform-independent. The
# one blind spot is doc/doctest inside `#[cfg(windows)]` / `#[cfg(target_os
# = …)]` code, which only the full `test` matrix compiles; acceptable for a
# gate whose job is broken links and stale locks, not platform behavior.
fast-checks:
runs-on: ubuntu-24.04
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- uses: ./.github/actions/test-setup
- name: Install wt
uses: baptiste0928/cargo-install@v3
with:
crate: worktrunk
version: "=0.72.0"
- name: 🧪 Lockfile, doctests, rustdoc
run: wt hook pre-merge --yes lockfile doctest doc
# Check if Cargo/CI files changed (for conditional jobs below)
changes:
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
outputs:
cargo: ${{ steps.filter.outputs.cargo }}
docs: ${{ steps.filter.outputs.docs }}
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- uses: dorny/paths-filter@v4
id: filter
with:
filters: |
cargo:
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/ci.yaml'
docs:
- 'docs/**'
- 'src/cli/mod.rs'
msrv:
runs-on: ubuntu-24.04
needs: changes
if: needs.changes.outputs.cargo == 'true' || github.event_name == 'workflow_dispatch'
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- name: 💰 Cache
uses: Swatinem/rust-cache@v2
with:
# Own cache — `cargo msrv verify` builds with older toolchains whose
# rustc hash never matches the shared (stable) test cache. Gated to
# main; this job only runs when Cargo/toolchain files change.
cache-bin: "false"
save-if: ${{ github.ref == 'refs/heads/main' }}
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-msrv
version: "=0.19.3"
- name: Verify minimum rust version
run: cargo msrv verify
check-docs:
runs-on: ubuntu-24.04
needs: changes
if: needs.changes.outputs.docs == 'true' || github.event_name == 'workflow_dispatch'
steps:
- name: 📂 Checkout code
uses: actions/checkout@v7
- name: Setup Zola
uses: taiki-e/install-action@v2.85.11
with:
tool: zola@0.22.1
- name: 🕷️ Build docs
run: zola build
working-directory: docs