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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
name: nightly
# Slower checks that aren't worth running on every PR but should run before a
# release. Jobs:
# - feature-powerset: feature-flag unification, check + test suite (motivated by #2442)
# - release-target: PTY+shell suite on the release triples ci.yaml doesn't cover
# - benchmarks: full criterion suite + time-series gist append (cron only)
# - check-unused-dependencies: cargo-udeps on nightly toolchain
# - minimal-versions: cargo check against minimum-version dep resolution
# - nix-flake: nix flake check (packaging-environment bugs, motivated by #2624)
# - crate-build: build the crates.io archive with no `.git` (faithful #3123 repro)
#
# Runs daily on cron, on demand via workflow_dispatch, on pushes to main that
# touch dependency or toolchain files, and on PRs that either (a) touch the
# same dependency/toolchain files or (b) carry the `nightly` label. The
# label is the iteration knob for fixes targeting nightly-only failures
# (e.g. nix-flake's sandbox suite); without it, contributors had to wait for
# the cron run or `gh workflow run` manually. The cron still catches drift
# that's not commit-correlated (registry updates, transitive resolution).
#
# Runner versions pinned; see ci.yaml header comment for rationale.
on:
schedule:
# Run at 5:37 UTC every day. Off-peak minute (avoid :00 to be a good
# citizen w.r.t. GitHub's cron scheduler).
- cron: '37 5 * * *'
workflow_dispatch:
push:
branches:
paths:
- '**/Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/nightly.yaml'
pull_request:
branches:
# `labeled` fires when a label is added (so the `nightly` label can
# trigger a run mid-PR); `synchronize` re-runs on subsequent pushes.
# The `gate` job below decides whether to actually run, ORing the
# label against a Cargo-paths diff check.
types:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
RUSTFLAGS: -C debuginfo=0
jobs:
gate:
# Decides whether to run on PR events. Non-PR events (cron,
# workflow_dispatch, push) pass through unconditionally. PR events
# run when either the `nightly` label is attached OR the diff touches
# one of the dependency/toolchain files. The decision is exposed via
# `outputs.run`; downstream jobs gate on it.
#
# `dorny/paths-filter` works against the GitHub API for PR events, so
# no checkout step is needed.
runs-on: ubuntu-24.04
permissions:
pull-requests: read
outputs:
run: ${{ steps.decide.outputs.run }}
steps:
- uses: dorny/paths-filter@v4
if: github.event_name == 'pull_request'
id: changes
with:
filters: |
nightly:
- '**/Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- '.github/workflows/nightly.yaml'
- id: decide
run: |
echo "run=${{ github.event_name != 'pull_request' ||
contains(github.event.pull_request.labels.*.name, 'nightly') ||
steps.changes.outputs.nightly == 'true' }}" >> "$GITHUB_OUTPUT"
feature-powerset:
# Every combination of cli/syntax-highlighting/shell-integration-tests/
# git-wt should compile. Catches regressions in feature gating โ including
# the v0.45.0 case where lib code used a `cli`-gated dependency
# unconditionally.
#
# Workspace members must use `default-features = false` when depending on
# worktrunk, or feature unification will mask gating bugs by silently
# enabling `cli` in the lib build (see tests/helpers/wt-perf/Cargo.toml).
#
# The test step runs the test suite per combination โ the check step
# strips dev-deps, so `#[cfg(test)]` code is invisible to it, and a test
# importing a feature-gated symbol without its own gate, or a snapshot
# baking feature-dependent output, only surfaces when tests are built and
# run per combo. The integration suite declares
# `required-features = ["cli", "syntax-highlighting"]` (Cargo.toml) because
# it execs the `wt` binary and snapshots its highlighted output, so cargo
# runs it only on combinations that satisfy both and runs lib + doc tests
# everywhere. No target filter, so default-members builds the mock-stub
# helper bin the lib suite shells out to.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- name: ๐ฐ Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-hack
uses: taiki-e/install-action@v2.82.0
with:
tool: cargo-hack
# The `shell-integration-tests` combinations run PTY tests that spawn real
# zsh/fish and probe nushell; match the test matrix's shell setup
# (.github/actions/test-setup) so those combinations run, not just compile.
- name: Install shells (zsh, fish)
uses: awalsh128/cache-apt-pkgs-action@v1.6.1
with:
packages: zsh fish
version: 1.0
- name: Install nushell
uses: hustcer/setup-nu@v3
with:
version: '0.113.1'
- run: cargo hack check --feature-powerset --no-dev-deps
- run: cargo hack test --feature-powerset
release-target:
# Build and run the test suite on the release triples that ci.yaml's
# `test` matrix doesn't cover โ `dist-workspace.toml` ships musl Linux
# (x86_64 + arm64) and Intel macOS, but the test matrix is glibc Linux,
# arm64 macOS, and Windows. Without this, a regression on those targets
# first surfaces at release-tag time, which blocks the release.
#
# Runs the integration suite (default features, no
# `shell-integration-tests`) โ covers file IO, command spawning, and
# output rendering on the cross-target triple, which is where
# musl-vs-glibc and intel-vs-arm divergence shows up. Shell-integration
# PTY tests are intentionally off because they read $SHELL from the
# runner env, which resolves differently on `ubuntu-24.04-arm` and
# masks musl/arm signal with environment noise.
needs: gate
if: needs.gate.outputs.run == 'true'
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
runner: ubuntu-24.04
install: musl-tools
- target: aarch64-unknown-linux-musl
runner: ubuntu-24.04-arm
install: musl-tools
- target: x86_64-apple-darwin
runner: macos-15-intel
name: release-target (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- name: Install musl-tools
if: matrix.install == 'musl-tools'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- uses: ./.github/actions/test-setup
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: ๐งช Tests
env:
NEXTEST_NO_INPUT_HANDLER: 1
run: cargo nextest run --target ${{ matrix.target }}
benchmarks:
# Full criterion suite. Moved here from ci.yaml โ runs ~80 min, was
# already advisory non-required (CLAUDE.md: "Don't wait for CI
# benchmarks before merging"). The cron run also appends results to the
# time-series gist so we have daily perf history on main.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- name: ๐ฐ Cache
uses: Swatinem/rust-cache@v2
- name: Install shells (zsh, fish)
uses: awalsh128/cache-apt-pkgs-action@v1.6.1
with:
packages: zsh fish
version: 1.0
- name: Install nushell
uses: hustcer/setup-nu@v3
with:
version: '0.113.1'
- name: ๐ฐ Rust repo cache
uses: actions/cache@v5
with:
path: target/bench-repos
key: bench-repos-rust-${{ runner.os }}
- name: ๐ Run benchmarks
run: cargo bench
- name: ๐ฆ Upload benchmark results
uses: actions/upload-artifact@v7
with:
name: benchmark-results-${{ github.run_id }}
path: target/criterion
# Time-series benchmark store, owned by worktrunk-bot:
# https://gist.github.com/worktrunk-bot/19bb23cb9658722abfe69479d0a4f9bf
#
# Cron-only: PR/push runs aren't appended (would pollute the time
# series). Skipped on forks: `TEND_BOT_TOKEN` is not exposed there.
- name: ๐พ Append results to gist
if: github.repository_owner == 'max-sixty' && github.event_name == 'schedule'
env:
GITHUB_TOKEN: ${{ secrets.TEND_BOT_TOKEN }}
GIST_ID: 19bb23cb9658722abfe69479d0a4f9bf
run: |
set -euo pipefail
python3 .github/scripts/criterion-to-jsonl.py --sha "$GITHUB_SHA" > new-rows.jsonl
git clone "https://x-access-token:${GITHUB_TOKEN}@gist.github.com/${GIST_ID}.git" /tmp/gist
cat new-rows.jsonl >> /tmp/gist/results.jsonl
git -C /tmp/gist \
-c user.name=worktrunk-bot \
-c user.email=worktrunk-bot@users.noreply.github.com \
commit -am "benchmarks: ${GITHUB_SHA::7}"
git -C /tmp/gist push
check-unused-dependencies:
# Moved from ci.yaml โ `cargo udeps` requires nightly toolchain anyway,
# so it's already in the "nightly concern" bucket; rarely flips between
# PRs touching deps.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
# cargo-udeps requires nightly; update date periodically
- run: rustup override set nightly-2026-03-01
- name: ๐ฐ Cache
uses: Swatinem/rust-cache@v2
- uses: baptiste0928/cargo-install@v3
with:
crate: cargo-udeps
version: "=0.1.61"
- uses: clechasseur/rs-cargo@v5.0.5
with:
command: udeps
args: --all-targets
minimal-versions:
# Verify `Cargo.toml` constraints aren't under-specified โ library
# consumers (the lib/CLI cleave is real; `feature-check` in ci.yaml
# exists for the same downstream-protection reason) can resolve to a
# lower compatible version that doesn't actually compile if our manifest
# under-specifies.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- run: rustup override set nightly-2026-03-01
- name: ๐ฐ Cache
uses: Swatinem/rust-cache@v2
with:
key: minimal-versions
- name: Resolve to minimum versions
# `direct`, not full `-Z minimal-versions`: minimize only worktrunk's own
# direct deps and let transitive crates resolve normally. Full minimization
# also walks skim 4.8's TUI/image stack (ansi-to-tui, ratatui's
# `instability` macro, color-eyre, ratatui-image -> image/avif -> num-* and
# bitvec), whose crates under-declare their floors and don't compile at the
# picked versions โ upstream brokenness, not ours, that we'd have to pin
# around. Direct minimization confines the check to floors we actually own;
# they're raised in the manifests to the minimums the tree builds against.
run: cargo update -Z direct-minimal-versions
- name: cargo check
run: cargo check --workspace --all-targets
crate-build:
# Faithful end-to-end guard for #3123: build the crates.io *source archive*
# in a directory with no ancestor `.git` and confirm `wt` both compiles and
# reports the cargo version (the `option_env!("VERGEN_GIT_DESCRIBE")`
# fallback). ci.yaml's fast `vergen_env_vars_are_read_optionally` guard
# catches the mechanism (`env!` vs `option_env!`) on every PR by scanning
# source; this reproduces the actual `cargo install` condition โ a full
# from-scratch build (~minutes), which is why it's `#[ignore]`d and run here
# via `--ignored`. A regression that an in-tree build can't see (git
# describe ascends to the outer repo) surfaces only on this no-git build.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- name: ๐ฐ Cache
uses: Swatinem/rust-cache@v2
- name: ๐งช Build crates.io archive without .git
run: cargo test --test integration crate_io_archive_builds_and_versions_without_git -- --ignored
nix-flake:
# Build and test under the nix sandbox so packaging-environment bugs
# surface before a release / nixpkgs maintainer hits them. See #2624 for
# the canonical example: a unit test that depends on the process CWD
# being inside a git repo, which fails in the sandbox where source is
# extracted from a tarball without `.git`.
#
# Runs `nix flake check`, which exercises every check defined in
# flake.nix โ in particular `worktrunk-tests`, which runs `cargo test`
# with default features (lib + bins + integration + doctests; the
# `shell-integration-tests` feature is intentionally off). Cold builds
# take ~10-15 min without a binary cache; nightly cadence absorbs it.
needs: gate
if: needs.gate.outputs.run == 'true'
runs-on: ubuntu-24.04
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: nix flake check
run: nix flake check --print-build-logs --keep-going
create-issue-on-nightly-failure:
needs:
- feature-powerset
- release-target
- benchmarks
- check-unused-dependencies
- minimal-versions
- nix-flake
- crate-build
if: always() && contains(needs.*.result, 'failure') && github.repository_owner == 'max-sixty' && github.event_name == 'schedule'
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
steps:
- name: ๐ Checkout code
uses: actions/checkout@v6
- uses: JasonEtco/create-an-issue@v2
env:
# Use TEND_BOT_TOKEN for a consistent bot identity (per
# .github/CLAUDE.md) and so any future issue-triage automation can
# cascade off issue creation โ events from the default GITHUB_TOKEN
# don't trigger other workflows.
GITHUB_TOKEN: ${{ secrets.TEND_BOT_TOKEN }}
LINK: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
filename: .github/nightly-failure.md
update_existing: true
search_existing: open