Skip to content

Commit 6e50bfd

Browse files
committed
fix(ci): isolate cargo-rail bootstrap target dir on Windows
1 parent fa39716 commit 6e50bfd

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

justfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ test crate="":
77
build:
88
@echo "Change Detection Plan:"
99
@echo ""
10-
@cargo run --quiet -- rail plan --merge-base --explain
10+
@cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail plan --merge-base --explain
1111
@echo ""
1212
@echo "Building affected crates..."
13-
@cargo run --quiet -- rail run --merge-base --profile local --surface build
13+
@cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail run --merge-base --profile local --surface build
1414

1515
build-release:
1616
@echo "Change Detection Plan:"
1717
@echo ""
18-
@cargo run --quiet -- rail plan --merge-base --explain
18+
@cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail plan --merge-base --explain
1919
@echo ""
2020
@echo "Building affected crates (release)..."
21-
@cargo run --quiet -- rail run --merge-base --profile local --surface build -- --release
21+
@cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail run --merge-base --profile local --surface build -- --release
2222

2323
# Full Workspace Commands (no change detection)
2424

@@ -43,18 +43,18 @@ ci-test:
4343
@scripts/test/test.sh
4444

4545
ci-build:
46-
@cargo run --quiet -- rail run --since "${RAIL_SINCE:-HEAD~1}" --surface build
46+
@cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail run --since "${RAIL_SINCE:-HEAD~1}" --surface build
4747

4848
# Explainability
4949

5050
plan:
51-
cargo run --quiet -- rail plan --merge-base -f json
51+
cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail plan --merge-base -f json
5252

5353
why:
54-
cargo run --quiet -- rail plan --merge-base --explain
54+
cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail plan --merge-base --explain
5555

5656
dry-run surface="test":
57-
cargo run --quiet -- rail run --merge-base --surface {{ surface }} --dry-run --print-cmd --explain
57+
cargo run --quiet --target-dir "${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}" -- rail run --merge-base --surface {{ surface }} --dry-run --print-cmd --explain
5858

5959
# Maintenance
6060

scripts/check/check.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ set -euo pipefail
1616
# CARGO_RAIL_TEST_MODE # "commit" forces CI mode
1717
# RAIL_SINCE # Git ref for comparison
1818

19-
RAIL_CMD=(cargo run --quiet -- rail)
19+
# Run the control-plane cargo-rail binary from an isolated target dir.
20+
# This avoids Windows file-lock conflicts when cargo-rail later asks Cargo
21+
# to build or test the workspace's own `target` tree.
22+
RAIL_BOOTSTRAP_TARGET_DIR="${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}"
23+
RAIL_CMD=(cargo run --quiet --target-dir "$RAIL_BOOTSTRAP_TARGET_DIR" -- rail)
2024

2125
# Parse arguments
2226
CI_MODE=false

scripts/test/test.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ set -euo pipefail
1515
# CARGO_RAIL_TEST_MODE # "local" (default) or "commit" (CI)
1616
# RAIL_SINCE # Git ref for CI comparison
1717

18-
RAIL_CMD=(cargo run --quiet -- rail)
18+
# Run the control-plane cargo-rail binary from an isolated target dir.
19+
# On Windows, `cargo nextest` cannot rebuild `target/debug/cargo-rail.exe`
20+
# while that exact binary is still running via `cargo run`.
21+
RAIL_BOOTSTRAP_TARGET_DIR="${RAIL_BOOTSTRAP_TARGET_DIR:-target/cargo-rail-bootstrap}"
22+
RAIL_CMD=(cargo run --quiet --target-dir "$RAIL_BOOTSTRAP_TARGET_DIR" -- rail)
1923

2024
ARG="${1:-}"
2125
MODE="${CARGO_RAIL_TEST_MODE:-local}"

0 commit comments

Comments
 (0)