Cut GitHub Actions macOS minutes with a test before you push
# Cut GitHub Actions macOS minutes with a test before you push
GitHub bills macOS minutes at 10 times the Linux rate (https://docs.github.com/en/billing/reference/actions-runner-pricing), and an agent that pushes on every change spends those minutes on builds that fail. Running the tests before the push means a failing change never reaches the runner.
Run it
box setup --pre-push
This writes .git/hooks/pre-push in the repository. The hook runs box test and stops the push when the tests fail. Its own words, from the CLI source:
box: pre-push: running box test before the push (skip once: git push --no-verify) box: pre-push: the tests failed, so the push was stopped. Fix them and push again, or push anyway with: git push --no-verify
What that test run prints, from job bj_FsKyhQhqbroz8BoM:
Test Suite 'All tests' passed at 2026-11-28 03:05:14.925. ** TEST EXECUTE SUCCEEDED ** box: tests 1 passed, 0 failed box: bj_FsKyhQhqbroz8BoM succeeded, 120s billed, $0.10
What it costs
$0.05 per minute of build and test time on iOS, every started minute, and only when a push runs the tests.
How else people do this
GitHub-hosted macOS runners cost 10 times the Linux per-minute rate (https://docs.github.com/en/billing/reference/actions-runner-pricing). A pre-push test does not replace the runner. It stops failed pushes from using it.
Apple, Mac, macOS, iPhone, Xcode, Swift and SwiftUI are trademarks of Apple Inc., registered in the U.S. and other countries and regions. box is an independent service and is not affiliated with, sponsored or endorsed by Apple Inc.