Skip to content

Commit e82e9fa

Browse files
authored
Merge pull request #1904 from EliahKagan/run-ci/just
Make the justfile more portable and slightly more resilient
2 parents 40d8033 + fdfcedd commit e82e9fa

File tree

1 file changed

+55
-46
lines changed

1 file changed

+55
-46
lines changed

justfile

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,37 @@
22
# ^ A shebang isn't required, but allows a justfile to be executed
33
# like a script, with `./justfile test`, for example.
44

5+
j := quote(just_executable())
6+
7+
# List available recipes
58
default:
6-
{{ just_executable() }} --list
9+
{{ j }} --list
710

811
alias t := test
912
alias c := check
1013
alias nt := nextest
1114

12-
# run all tests, clippy, including journey tests, try building docs
15+
# Run all tests, clippy, including journey tests, try building docs
1316
test: clippy check doc unit-tests journey-tests-pure journey-tests-small journey-tests-async journey-tests check-mode
1417

15-
# run all tests, without clippy, and try building docs
18+
# Run all tests, without clippy, and try building docs
1619
ci-test: check doc unit-tests check-mode
1720

18-
# run all journey tests - should be run in a fresh clone or after `cargo clean`
21+
# Run all journey tests - should be run in a fresh clone or after `cargo clean`
1922
ci-journey-tests: journey-tests-pure journey-tests-small journey-tests-async journey-tests
2023

24+
# Clean the `target` directory
2125
clear-target:
2226
cargo clean
2327

24-
# Run cargo clippy on all crates
28+
# Run `cargo clippy` on all crates
2529
clippy *clippy-args:
2630
cargo clippy --workspace --all-targets -- {{ clippy-args }}
2731
cargo clippy --workspace --no-default-features --features small -- {{ clippy-args }}
2832
cargo clippy --workspace --no-default-features --features max-pure -- {{ clippy-args }}
2933
cargo clippy --workspace --no-default-features --features lean-async --tests -- {{ clippy-args }}
3034

31-
# Run cargo clippy on all crates, fixing what can be fixed, and format all code
35+
# Run `cargo clippy` on all crates, fixing what can be fixed, and format all code
3236
clippy-fix:
3337
cargo clippy --fix --workspace --all-targets
3438
cargo clippy --fix --allow-dirty --workspace --no-default-features --features small
@@ -143,12 +147,12 @@ check:
143147
cargo check -p gix-odb --features serde
144148
cargo check --no-default-features --features max-control
145149

146-
# Run cargo doc on all crates
147-
doc $RUSTDOCFLAGS="-D warnings":
150+
# Run `cargo doc` on all crates
151+
doc $RUSTDOCFLAGS='-D warnings':
148152
cargo doc --workspace --no-deps --features need-more-recent-msrv
149153
cargo doc --features=max,lean,small --workspace --no-deps --features need-more-recent-msrv
150154

151-
# run all unit tests
155+
# Run all unit tests
152156
unit-tests:
153157
cargo nextest run
154158
cargo test --doc
@@ -158,9 +162,9 @@ unit-tests:
158162
cargo nextest run -p gix-archive --features tar
159163
cargo nextest run -p gix-archive --features tar_gz
160164
cargo nextest run -p gix-archive --features zip
161-
cargo nextest run -p gix-status-tests --features "gix-features-parallel"
162-
cargo nextest run -p gix-worktree-state-tests --features "gix-features-parallel"
163-
cargo nextest run -p gix-worktree-tests --features "gix-features-parallel"
165+
cargo nextest run -p gix-status-tests --features gix-features-parallel
166+
cargo nextest run -p gix-worktree-state-tests --features gix-features-parallel
167+
cargo nextest run -p gix-worktree-tests --features gix-features-parallel
164168
cd gix-object; \
165169
set -ex; \
166170
cargo nextest run; \
@@ -172,10 +176,10 @@ unit-tests:
172176
cargo nextest run -p gix-odb-tests --features gix-features-parallel
173177
cargo nextest run -p gix-pack --all-features
174178
cargo nextest run -p gix-pack-tests --features all-features
175-
cargo nextest run -p gix-pack-tests --features "gix-features-parallel"
176-
cargo nextest run -p gix-index-tests --features "gix-features-parallel"
179+
cargo nextest run -p gix-pack-tests --features gix-features-parallel
180+
cargo nextest run -p gix-index-tests --features gix-features-parallel
177181
cargo nextest run -p gix-packetline --features blocking-io,maybe-async/is_sync --test blocking-packetline
178-
cargo nextest run -p gix-packetline --features "async-io" --test async-packetline
182+
cargo nextest run -p gix-packetline --features async-io --test async-packetline
179183
cargo nextest run -p gix-transport --features http-client-curl,maybe-async/is_sync
180184
cargo nextest run -p gix-transport --features http-client-reqwest,maybe-async/is_sync
181185
cargo nextest run -p gix-transport --features async-client
@@ -191,75 +195,80 @@ unit-tests:
191195
unit-tests-flaky:
192196
cargo test -p gix --features async-network-client-async-std
193197

194-
target_dir := `cargo metadata --format-version 1 | jq -r .target_directory`
195-
ein := target_dir / "debug/ein"
196-
gix := target_dir / "debug/gix"
197-
jtt := target_dir / "debug/jtt"
198-
it := target_dir / "debug/it"
198+
# Depend on this to pre-generate metadata, and/or use it inside a recipe as `"$({{ j }} dbg)"`
199+
[private]
200+
dbg:
201+
set -eu; \
202+
target_dir="$(cargo metadata --format-version 1 | jq -r .target_directory)"; \
203+
test -n "$target_dir"; \
204+
echo "$target_dir/debug"
199205

200-
# run journey tests (max)
201-
journey-tests:
206+
# Run journey tests (`max`)
207+
journey-tests: dbg
202208
cargo build --features http-client-curl-rustls
203209
cargo build -p gix-testtools --bin jtt
204-
./tests/journey.sh {{ ein }} {{ gix }} {{ jtt }} max
210+
dbg="$({{ j }} dbg)" && tests/journey.sh "$dbg/ein" "$dbg/gix" "$dbg/jtt" max
205211

206-
# run journey tests (max-pure)
207-
journey-tests-pure:
212+
# Run journey tests (`max-pure`)
213+
journey-tests-pure: dbg
208214
cargo build --no-default-features --features max-pure
209215
cargo build -p gix-testtools --bin jtt
210-
./tests/journey.sh {{ ein }} {{ gix }} {{ jtt }} max-pure
216+
dbg="$({{ j }} dbg)" && tests/journey.sh "$dbg/ein" "$dbg/gix" "$dbg/jtt" max-pure
211217

212-
# run journey tests (small)
213-
journey-tests-small:
218+
# Run journey tests (`small`)
219+
journey-tests-small: dbg
214220
cargo build --no-default-features --features small
215221
cargo build -p gix-testtools
216-
./tests/journey.sh {{ ein }} {{ gix }} {{ jtt }} small
222+
dbg="$({{ j }} dbg)" && tests/journey.sh "$dbg/ein" "$dbg/gix" "$dbg/jtt" small
217223

218-
# run journey tests (lean-async)
219-
journey-tests-async:
224+
# Run journey tests (`lean-async`)
225+
journey-tests-async: dbg
220226
cargo build --no-default-features --features lean-async
221227
cargo build -p gix-testtools
222-
./tests/journey.sh {{ ein }} {{ gix }} {{ jtt }} async
228+
dbg="$({{ j }} dbg)" && tests/journey.sh "$dbg/ein" "$dbg/gix" "$dbg/jtt" async
223229

224-
# Run cargo-diet on all crates to see that they are still in bound
230+
# Run `cargo diet` on all crates to see that they are still in bounds
225231
check-size:
226-
./etc/check-package-size.sh
232+
etc/check-package-size.sh
227233

228-
# Check the minimal support rust version for currently installed Rust version
234+
# Check the minimal support Rust version, with the currently installed Rust version
229235
ci-check-msrv:
230236
rustc --version
231237
cargo check -p gix
232238
cargo check -p gix --no-default-features --features async-network-client,max-performance
233239

234-
# Enter a nix-shell able to build on macos
240+
# Enter a nix-shell able to build on macOS
235241
nix-shell-macos:
236242
nix-shell -p pkg-config openssl libiconv darwin.apple_sdk.frameworks.Security darwin.apple_sdk.frameworks.SystemConfiguration
237243

238-
# run various auditing tools to assure we are legal and safe
244+
# Run various auditing tools to help us stay legal and safe
239245
audit:
240246
cargo deny check advisories bans licenses sources
241247

242-
# run tests with `cargo nextest` (all unit-tests, no doc-tests, faster)
243-
nextest *FLAGS="--workspace":
248+
# Run tests with `cargo nextest` (all unit-tests, no doc-tests, faster)
249+
nextest *FLAGS='--workspace':
244250
cargo nextest run {{ FLAGS }}
245251

246-
summarize EXPRESSION="all()": (nextest "--workspace --run-ignored all --no-fail-fast --status-level none --final-status-level none -E '" EXPRESSION "'")
252+
# Run tests with `cargo nextest`, skipping none except as filtered, omitting status reports
253+
summarize EXPRESSION='all()':
254+
cargo nextest run --workspace --run-ignored all --no-fail-fast \
255+
--status-level none --final-status-level none -E {{ quote(EXPRESSION) }}
247256

248-
# run nightly rustfmt for its extra features, but check that it won't upset stable rustfmt
257+
# Run nightly `rustfmt` for its extra features, but check that it won't upset stable `rustfmt`
249258
fmt:
250259
cargo +nightly fmt --all -- --config-path rustfmt-nightly.toml
251260
cargo +stable fmt --all -- --check
252-
just --fmt --unstable
261+
{{ j }} --fmt --unstable
253262

254-
# Cancel this after the first few seconds, as yanked crates will appear in warnings.
263+
# Cancel this after the first few seconds, as yanked crates will appear in warnings
255264
find-yanked:
256265
cargo install --debug --locked --no-default-features --features max-pure --path .
257266

258267
# Find shell scripts whose +x/-x bits and magic bytes (e.g. `#!`) disagree
259268
check-mode:
260269
cargo build -p internal-tools
261-
"{{ it }}" check-mode
270+
cargo run -p internal-tools -- check-mode
262271

263-
# Delete gix-packetline-blocking/src and regenerate from gix-packetline/src
272+
# Delete `gix-packetline-blocking/src` and regenerate from `gix-packetline/src`
264273
copy-packetline:
265-
./etc/copy-packetline.sh
274+
etc/copy-packetline.sh

0 commit comments

Comments
 (0)