Agent Wranglers

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.

Example

#!/usr/bin/env bash
# check.sh: every rule, the whole site, 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 "Unit tests" npm test --prefix site
check "Build gates and writing style" npm run build --prefix site
check "Server and end-to-end tests" npm test --prefix server
check "Browser: accessibility, console, scrolling" lab/check.sh
exit $failed
PASS  Unit tests
PASS  Build gates and writing style
PASS  Server and end-to-end tests
PASS  Browser: accessibility, console, scrolling

How to check

Run the script on a clean build. It prints PASS for every check and exits with zero.

Measured

On a reference site, the full check covered 227 pages at phone and desktop width, in light and dark mode, in 2 minutes 51 seconds.

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-site-check-before-every-deploy.