Skip to content

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

ci(nightly): add nix flake check job (#2630)

Maximilian Roos793307aa3d41
diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml
index 7a78da629..0ea029ee1 100644
--- a/.github/workflows/nightly.yaml
+++ b/.github/workflows/nightly.yaml
@@ -47,9 +47,37 @@ jobs:
- name: cargo hack check --feature-powerset --no-dev-deps
run: cargo hack check --feature-powerset --no-dev-deps
+ 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.
+ 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
+ - nix-flake
if: always() && contains(needs.*.result, 'failure') && github.repository_owner == 'max-sixty' && github.event_name == 'schedule'
runs-on: ubuntu-24.04
permissions:
diff --git a/flake.nix b/flake.nix
index 3b02cb2f6..08487fc81 100644
--- a/flake.nix
+++ b/flake.nix
@@ -164,6 +164,24 @@
# Check formatting
worktrunk-fmt = craneLib.cargoFmt { inherit src; };
+
+ # Run tests inside the nix sandbox. Catches packaging-environment
+ # bugs (#2624 is the canonical example) before nixpkgs maintainers
+ # do β€” see .github/workflows/nightly.yaml.
+ #
+ # Wider src than the package build: tests need .snap files and
+ # tests/ fixtures (prebuilt _git/ trees, .sh scripts, no-extension
+ # git database files). Default features only β€” shell-integration-
+ # tests requires zsh/fish/nushell + PTY (see CLAUDE.md β†’ "Shell/PTY
+ # Integration Tests").
+ worktrunk-tests = craneLib.cargoTest (
+ commonArgs
+ // {
+ inherit cargoArtifacts;
+ src = pkgs.lib.cleanSource ./.;
+ nativeBuildInputs = commonArgs.nativeBuildInputs ++ [ pkgs.git ];
+ }
+ );
};
packages = {