Skip to content
Merged
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- Minimize `unwrap()` in non-test code — use proper error handling
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- Minimize `unwrap()` in non-test code — use proper error handling
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- Minimize `unwrap()` in non-test code — use proper error handling
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail
- `gh` (GitHub CLI) is not installed — do not attempt to use it
1 change: 1 addition & 0 deletions template/ai-instructions/shared.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- Minimize `unwrap()` in non-test code — use proper error handling
- Install toolchain before running tests: `rustup toolchain install "$(< rust-toolchain)" && rustup component add --toolchain "$(< rust-toolchain)" rustfmt clippy`
- Run `FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh` to validate changes
- Set `PDU_NO_FAIL_FAST=true` to run all checks instead of stopping at the first failure — this lets you see which checks pass and which fail
34 changes: 33 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
#! /bin/bash
set -o errexit -o pipefail -o nounset

# Validate PDU_NO_FAIL_FAST
no_fail_fast="${PDU_NO_FAIL_FAST:-false}"
case "$no_fail_fast" in
true | false) ;;
*)
echo "error: Invalid value for PDU_NO_FAIL_FAST: $no_fail_fast (expected 'true' or 'false')" >&2
exit 1
;;
esac

# A temporary file is used instead of a variable because run_if and unit are
# subshells, so variable assignments inside them don't propagate to the parent.
failure_dir=$(mktemp -d)
failure_marker="$failure_dir/failed"
Comment thread
KSXGitHub marked this conversation as resolved.

run() (
echo >&2
echo "exec> $*" >&2
Expand All @@ -16,7 +31,16 @@ run_if() (
condition="$1"
shift
case "$condition" in
true) run "$@" ;;
true)
if [[ $no_fail_fast == 'true' ]]; then
run "$@" || {
echo "error: Command $* failed with exit code $?" >&2
Comment thread
KSXGitHub marked this conversation as resolved.
Outdated
touch "$failure_marker"
}
else
run "$@"
fi
;;
false) skip "$@" ;;
*)
echo "error: Invalid condition: $condition" >&2
Expand All @@ -39,3 +63,11 @@ unit --all-features "$@"
unit --features cli "$@"
unit --features cli-completions "$@"
unit --features ai-instructions "$@"

if [[ -f "$failure_marker" ]]; then
rm -rf "$failure_dir"
echo >&2
echo 'error: Some checks have failed. Review the output above for details.' >&2
exit 1
fi
rm -rf "$failure_dir"
Loading