Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
Auto-build dev-detach binary via integration test trick (#130)
Maximilian Roos364bf03ebb58
diff --git a/.config/wt.toml b/.config/wt.tomlindex 322b49030..9f15ad393 100644--- a/.config/wt.toml+++ b/.config/wt.toml@@ -41,7 +41,5 @@ pre-commit = "pre-commit run --all-files"# Note: This must come AFTER post-merge because [pre-merge] starts# a TOML table section, and everything after it would be inside that section[pre-merge]-# Build test helpers first (dev-detach is a separate workspace member, not auto-built by cargo test)-build = "cargo build -p dev-detach"insta = "NEXTEST_STATUS_LEVEL=fail NEXTEST_SUCCESS_OUTPUT=never cargo insta test --dnd --check --features shell-integration-tests"doc = "RUSTDOCFLAGS='-Dwarnings' cargo doc --no-deps"diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yamlindex 35b71913d..c1c8c7102 100644--- a/.github/workflows/ci.yaml+++ b/.github/workflows/ci.yaml@@ -61,12 +61,6 @@ jobs:echo "Using Git Bash for Windows tests"shell: pwsh- - name: 🔧 Build test helpers- uses: clechasseur/rs-cargo@v4- with:- command: build- args: -p dev-detach-- name: 🏭 Compileuses: clechasseur/rs-cargo@v4with:diff --git a/Cargo.toml b/Cargo.tomlindex eff3f39a7..3925e231d 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -1,5 +1,7 @@[workspace]members = ["tests/helpers/setup-select-test", "tests/helpers/dev-detach"]+# Include dev-detach so `cargo test` builds its binary (via its integration test)+default-members = [".", "tests/helpers/dev-detach"][package]name = "worktrunk"diff --git a/tests/helpers/dev-detach/Cargo.toml b/tests/helpers/dev-detach/Cargo.tomlindex de4146ca8..3443b5831 100644--- a/tests/helpers/dev-detach/Cargo.toml+++ b/tests/helpers/dev-detach/Cargo.toml@@ -8,7 +8,7 @@# `publish = false` or `dist = false`. Moving test-only binaries to separate# packages with `publish = false` prevents them from being included in releases.#-# Alternative approaches that DON'T work:+# Alternative approaches that DON'T work for cargo-dist:# - `required-features = ["test-feature"]` on [[bin]]: cargo-dist still tries to# find and package the binary, failing with "bin not found" during release# - `[package.metadata.dist] dist = false` in main package: excludes the entire@@ -16,11 +16,11 @@# - `workspace.default-members`: makes `cargo build` include this package, but# `cargo test` only builds test targets, not binaries (even for selected packages)#-# BUILD REQUIREMENT:-# Since this is a separate workspace member (not a dependency of the main package),-# `cargo test` doesn't automatically build it. CI and pre-merge hooks must explicitly-# run `cargo build -p dev-detach` before running tests. The test code uses-# `insta_cmd::get_cargo_bin("dev-detach")` to locate the built binary at runtime.+# HOW THE BINARY GETS BUILT:+# `cargo test` only builds binaries for packages with integration tests (so tests+# can run the binary). This package has a dummy integration test (tests/builds.rs)+# that triggers binary compilation. Combined with `workspace.default-members`+# including this package, `cargo test` automatically builds the binary.## This is a workspace member (not a separate workspace) to share target/ and Cargo.lock.# Never published to crates.io (publish = false) - only used during testing.diff --git a/tests/helpers/dev-detach/tests/builds.rs b/tests/helpers/dev-detach/tests/builds.rsnew file mode 100644index 000000000..ca66e5b36--- /dev/null+++ b/tests/helpers/dev-detach/tests/builds.rs@@ -0,0 +1,5 @@+#[test]+fn builds() {+ // Intentionally empty.+ // This integration test forces cargo to build the package's binary when testing.+}