ENG-2Recommended
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.
Examples
Shell 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
Plain text example
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.
Sources
Related rules
- AID-1 Write one instructions file for agents in AI-assisted development
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/rules-as-code/run-one-check-before-every-deploy">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.