Check builds keep Go's modules and caches between runs (refs #118)
check / check (push) Waiting to run
check / check (push) Waiting to run
On sneak's rulings in sneak/prompts#113 and sneak/prompts#130. REPO_POLICIES.md and script/test, script/lint, script/docker and script/cibuild are the sneak/prompts copies at 0653579: the scripts pass a new CACHEBUST value instead of --no-cache, and the lint and test builds write no image. In each Dockerfile stage the system packages and the Go module download come above ARG CACHEBUST; every step that lints, tests or compiles, and the node stages' yarn install, comes after it. Go's build cache and golangci-lint's are cache mounts, and both go test runs carry -count=1. README.md and TODO.md say the same. Model: opus-5-5
This commit is contained in:
+9
-4
@@ -2,8 +2,13 @@
|
||||
# script/test: run the test suite. Testing is a phase of the Dockerfile
|
||||
# and this builds that phase alone, on the same terms as script/lint:
|
||||
# --target because a phase that is not the last stage is built only when
|
||||
# named, --no-cache because a cached test layer is a test that did not
|
||||
# run, and a tag so each build replaces the previous image.
|
||||
# named, and a new CACHEBUST value because a cached test layer is a test
|
||||
# that did not run; unlike --no-cache, it keeps the layers above the ARG
|
||||
# CACHEBUST line and the cache mounts. This relies on every stage of the
|
||||
# Dockerfile declaring ARG CACHEBUST before every step that lints, tests
|
||||
# or compiles; a stage without that line is served from cache on an
|
||||
# unchanged tree, with no warning. --output type=cacheonly writes no
|
||||
# image, since nothing uses one.
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||
@@ -11,9 +16,9 @@ ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
||||
|
||||
main() {
|
||||
cd "$ROOT"
|
||||
docker build --no-cache \
|
||||
docker build --build-arg CACHEBUST="$(date +%s)-$$" \
|
||||
--target test \
|
||||
-t "$("$SCRIPT_DIR/projectname")-test" .
|
||||
--output type=cacheonly .
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user