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 @@ -17,3 +17,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- 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. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
- 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 @@ -17,3 +17,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- 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. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
- 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 @@ -17,4 +17,5 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- 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. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
- 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 @@ -17,3 +17,4 @@ Read and follow the CONTRIBUTING.md file in this repository for all code style c
- 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. If a test fails with a hint about `RUSTFLAGS` and `--cfg pdu_test_skip_*`, follow the hint and rerun with the suggested flags.
- **ALWAYS run the full test suite** (`FMT=true LINT=true BUILD=true TEST=true DOC=true ./test.sh`) before committing, regardless of how trivial the change seems — this includes documentation-only changes, comment edits, config changes, and refactors. The test suite checks formatting, linting, building, tests, and docs across multiple feature combinations; any type of change can break any of these checks.
- 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
36 changes: 35 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#! /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)
trap 'rm -rf "$failure_dir"' EXIT
failure_marker="$failure_dir/failed"
Comment thread
KSXGitHub marked this conversation as resolved.

run() (
echo >&2
echo "exec> $*" >&2
Expand All @@ -16,7 +32,19 @@ run_if() (
condition="$1"
shift
case "$condition" in
true) run "$@" ;;
true)
if [[ $no_fail_fast == 'true' ]]; then
run "$@" || {
exit_status=$?
printf 'error: Command failed with exit code %d: ' "$exit_status" >&2
printf '%q ' "$@" >&2
printf '\n' >&2
touch "$failure_marker"
}
else
run "$@"
fi
;;
false) skip "$@" ;;
*)
echo "error: Invalid condition: $condition" >&2
Expand All @@ -39,3 +67,9 @@ unit --all-features "$@"
unit --features cli "$@"
unit --features cli-completions "$@"
unit --features ai-instructions "$@"

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