Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

ci: consolidate slow checks onto the nightly workflow (#2636)

Maximilian Roos2f8807eb368a
diff --git a/.claude/skills/running-tend/SKILL.md b/.claude/skills/running-tend/SKILL.md
index bfdcee4c3..9de1e2b1c 100644
--- a/.claude/skills/running-tend/SKILL.md
+++ b/.claude/skills/running-tend/SKILL.md
@@ -211,8 +211,8 @@ Pinned third-party versions in CI are invisible to Dependabot — it follows `Ca
For each weekly run, check upstream and bump:
-- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/ci.yaml` and `.github/actions/{test,claude}-setup/action.yaml` — every `version: "=X.Y.Z"` against `cargo info <crate>`. Today: `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. The `cargo-affected` install has no version pin (follows default branch) — leave it alone. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).
-- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Three call sites: `ci.yaml` (`benchmarks`, `code-coverage`) and `actions/test-setup/action.yaml`.
+- **`baptiste0928/cargo-install@v3` blocks** in `.github/workflows/ci.yaml`, `.github/workflows/nightly.yaml`, and `.github/actions/{test,claude}-setup/action.yaml` — every `version: "=X.Y.Z"` against `cargo info <crate>`. Today: `cargo-insta`, `cargo-nextest`, `cargo-llvm-cov`, `cargo-msrv`, `cargo-udeps`, `lychee`, `worktrunk`. The `cargo-affected` install has no version pin (follows default branch) — leave it alone. Verify each crate's `rust-version` against the pinned toolchain and note compatibility in the PR body (see PR #1657 for the format).
+- **`hustcer/setup-nu@v3`** `version:` input — latest from `gh api repos/nushell/nushell/releases/latest --jq '.tag_name'`. Three call sites: `ci.yaml` (`code-coverage`), `nightly.yaml` (`benchmarks`), and `actions/test-setup/action.yaml`.
- **`taiki-e/[email protected]`** `tool: zola@<ver>` in the `check-docs` job — latest from `gh api repos/getzola/zola/releases/latest --jq '.tag_name'`.
- **Runner images** — `ubuntu-24.04`, `macos-15`, `windows-2022`. Keep `windows-2022` pinned (actions/runner-images#12677 — windows-2025 lacks the D: drive).
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 60f60b7d8..6c107c6aa 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -164,30 +164,6 @@ jobs:
- name: Verify minimum rust version
run: cargo msrv verify
- check-unused-dependencies:
- 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@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.60"
-
- - uses: clechasseur/[email protected]
- with:
- command: udeps
- args: --all-targets
-
check-docs:
runs-on: ubuntu-24.04
needs: changes
@@ -205,37 +181,6 @@ jobs:
run: zola build
working-directory: docs
- benchmarks:
- 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@v6
-
- - name: 💰 Cache
- uses: Swatinem/rust-cache@v2
-
- - name: Install shells (zsh, fish)
- uses: awalsh128/[email protected]
- with:
- packages: zsh fish
- version: 1.0
-
- - name: Install nushell
- uses: hustcer/setup-nu@v3
- with:
- version: '0.112.2'
-
- - 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
-
# cargo-affected: runs only the tests whose recorded coverage overlaps the
# diff. Advisory at this stage — `test (linux/macos/windows)` still runs the
# full suite. The signal is the runtime delta on the exact-match path and
diff --git a/.github/workflows/nightly-benchmark.yaml b/.github/workflows/nightly-benchmark.yaml
deleted file mode 100644
index f31ff0bf2..000000000
--- a/.github/workflows/nightly-benchmark.yaml
+++ /dev/null
@@ -1,62 +0,0 @@
-name: nightly-benchmark
-# Runner versions pinned; see ci.yaml header comment for rationale.
-
-on:
- schedule:
- # Run at 4:17 UTC every day (off-peak minute)
- - cron: '17 4 * * *'
- workflow_dispatch:
-
-env:
- CARGO_TERM_COLOR: always
- CARGO_INCREMENTAL: 0
- RUSTFLAGS: -C debuginfo=0
-
-jobs:
- benchmark:
- runs-on: ubuntu-24.04
- steps:
- - name: 📂 Checkout code
- uses: actions/checkout@v6
-
- - name: 💰 Cargo cache
- uses: Swatinem/rust-cache@v2
-
- - name: 💰 Rust repo cache
- uses: actions/cache@v5
- with:
- path: target/bench-repos
- key: bench-repos-rust-${{ runner.os }}
-
- - name: 📊 Run all benchmarks
- run: cargo bench --bench list
-
- - 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
- #
- # Skipped on forks: `WORKTRUNK_BOT_TOKEN` is not exposed to forks. This is
- # the canonical fork guard for any step or job that references repository
- # secrets — see also `code-coverage` (ci.yaml) and `deploy-docs`
- # (publish-docs.yaml).
- - name: 💾 Append results to gist
- if: github.repository_owner == 'max-sixty'
- env:
- # Bot identity for consistent attribution (per .github/CLAUDE.md).
- GITHUB_TOKEN: ${{ secrets.WORKTRUNK_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 \
- commit -am "benchmarks: ${GITHUB_SHA::7}"
- git -C /tmp/gist push
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index 0ea029ee1..ac92cb0f5 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -1,20 +1,44 @@
name: nightly
-# Catches feature-flag breakage that workspace feature unification can mask;
-# see #2442 for the v0.45.0 incident that motivated this.
+# Slower checks that aren't worth running on every PR but should run before a
+# release. Jobs:
+# - feature-powerset: feature-flag unification (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)
#
-# Runs daily and can be triggered manually. Not wired to push or pull_request —
-# this is a slow check that addresses a class of bug that only matters at
-# integration time, not per-commit.
+# Runs daily on cron, on demand via workflow_dispatch, and on pushes/PRs that
+# touch dependency or toolchain files — catching cargo-affecting changes at
+# PR time avoids a 24-hour bisect window. The cron run 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), and offset from
- # nightly-benchmark.yaml (4:17 UTC) so they don't contend for runners.
+ # citizen w.r.t. GitHub's cron scheduler).
- cron: '37 5 * * *'
workflow_dispatch:
+ push:
+ branches: [main]
+ paths:
+ - 'Cargo.toml'
+ - 'Cargo.lock'
+ - 'rust-toolchain.toml'
+ - '.github/workflows/nightly.yaml'
+ pull_request:
+ branches: [main]
+ paths:
+ - 'Cargo.toml'
+ - 'Cargo.lock'
+ - 'rust-toolchain.toml'
+ - '.github/workflows/nightly.yaml'
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CARGO_TERM_COLOR: always
@@ -47,6 +71,161 @@ jobs:
- name: cargo hack check --feature-powerset --no-dev-deps
run: cargo hack check --feature-powerset --no-dev-deps
+ 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.
+ 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.
+ 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/[email protected]
+ with:
+ packages: zsh fish
+ version: 1.0
+
+ - name: Install nushell
+ uses: hustcer/setup-nu@v3
+ with:
+ version: '0.112.2'
+
+ - 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: `WORKTRUNK_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.WORKTRUNK_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 \
+ 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.
+ 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.60"
+
+ - uses: clechasseur/[email protected]
+ 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.
+ 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
+ run: cargo update -Z minimal-versions
+
+ - name: cargo check
+ run: cargo check --workspace --all-targets
+
nix-flake:
# Build and test under the nix sandbox so packaging-environment bugs
# surface before a release / nixpkgs maintainer hits them. See #2624 for
@@ -77,6 +256,10 @@ jobs:
create-issue-on-nightly-failure:
needs:
- feature-powerset
+ - release-target
+ - benchmarks
+ - check-unused-dependencies
+ - minimal-versions
- nix-flake
if: always() && contains(needs.*.result, 'failure') && github.repository_owner == 'max-sixty' && github.event_name == 'schedule'
runs-on: ubuntu-24.04
diff --git a/Cargo.toml b/Cargo.toml
index 79d6e9158..c0a35084f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -80,7 +80,7 @@ anyhow = "1.0"
anstream = "1.0"
anstyle = "1.0"
ansi-str = "0.9"
-color-print = "0.3"
+color-print = "0.3.7"
askama = { version = "0.16", default-features = false, features = ["derive", "std"] }
chrono = "0.4"
clap = { version = "4.6", features = ["derive", "unstable-ext", "wrap_help"], optional = true }
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index e862a7b16..be5206251 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -585,6 +585,15 @@ fn add_snapshot_path_prelude_filters(settings: &mut insta::Settings) {
// the project's normal target/ — see max-sixty/cargo-affected#12.
settings.add_filter(r"/target/affected/build/", "/target/");
+ // Normalize cross-target build dirs (target/<triple>/) to target/ when tests
+ // run via `cargo nextest run --target <triple>` — used by the nightly
+ // `release-target` matrix (musl, intel-darwin). Anchored on the vendor
+ // field of a Rust target triple to avoid matching unrelated subdirs.
+ settings.add_filter(
+ r"/target/[a-z0-9_]+-(?:unknown|apple|pc|wasi)-[a-z0-9_-]+/",
+ "/target/",
+ );
+
// Deliberately no global `\\` → `/` normalization here: it corrupts
// intentional backslashes (JSON `\u001b` ANSI escapes, shell line
// continuations) and worktrunk already emits forward-slash paths via
@@ -1195,13 +1204,12 @@ pub fn add_pty_filters(settings: &mut insta::Settings) {
///
/// Test binaries are run from the cargo target directory, which varies.
pub fn add_pty_binary_path_filters(settings: &mut insta::Settings) {
- // Match paths ending in target/debug/wt or target/release/wt
- // Also handles llvm-cov-target used by cargo-llvm-cov and affected/build/
- // used by cargo-affected (max-sixty/cargo-affected#12)
- settings.add_filter(
- r"[^\s]+/target/(?:llvm-cov-target/|affected/build/)?(?:debug|release)/wt",
- "[BIN]",
- );
+ // Match paths ending in target/.../{debug,release}/wt — covers the
+ // default layout (`target/debug/wt`), cargo-llvm-cov (`llvm-cov-target/`),
+ // cargo-affected (`affected/build/`, max-sixty/cargo-affected#12), and
+ // cross-target builds (e.g. `target/x86_64-unknown-linux-musl/debug/wt`
+ // from the nightly `release-target` matrix).
+ settings.add_filter(r"[^\s]+/target/(?:[^/\s]+/)*(?:debug|release)/wt", "[BIN]");
}
// =============================================================================