Rules as code Required
Run one check of everything before every deploy
Run every check against the whole project with one command, and let the deploy go ahead only when all of them pass.
How to do it
Keep one script that runs the unit tests, the build gates, the linters and type checker, and the end-to-end tests. For a website, add a browser run over every page in the sitemap. Print one PASS or FAIL line per check, keep the logs, and exit with a code other than zero if any check fails. Call the script at the top of the deploy script and in continuous integration. Give the check its own copy of the build, so a rebuild during the run cannot cause false failures.
Example
#!/usr/bin/env bash
# check.sh: every rule, the whole project, pass or fail
set -uo pipefail
failed=0
check() { name=$1; shift; if "$@" >/tmp/check.log 2>&1; then echo "PASS $name"; else echo "FAIL $name"; tail -20 /tmp/check.log; failed=1; fi; }
check "Lint and types" npm run lint
check "Unit tests" npm test
check "Build gates" npm run build
check "End-to-end tests" npm run e2e
check "Browser lab: accessibility and layout" npm run lab
exit $failed
PASS Lint and types
PASS Unit tests
PASS Build gates
PASS End-to-end tests
PASS Browser lab: accessibility and layout
How to check
Run the script on a clean build. It prints PASS for every check and exits with zero. Whenever you change how the script runs steps, plant a failure on purpose. The run must report it and exit with a code other than zero.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/rules-as-code/run-one-check-before-every-deploy.