check / check (push) Successful in 12s
make lint calls script/lint, the only way golangci-lint is run. Inside a container it runs the linter; anywhere else it builds Dockerfile.lint, whose last step runs script/lint again. Both Dockerfiles set container=docker to mark the container, since /.dockerenv is missing in build steps and present on hosts that are themselves containers. The Dockerfile lint stage runs make lint. A new CACHEBUST build-arg on every run keeps the lint step from being served from cache; a tmpfs mount keeps Go's and golangci-lint's caches out of that step's layer, so runs do not pile up build cache. script/bootstrap and the nix-shell package lists no longer carry golangci-lint. golangci-lint config verify is not run: it fetches its schema over an unpinned live HTTPS call. Model: opus-4-8 (implementation); opus-5-5 (rework)
28 lines
971 B
Bash
Executable File
28 lines
971 B
Bash
Executable File
#!/bin/sh
|
|
# script/test: run the test suite. CGO dependencies (pkg-config, vips,
|
|
# libheif) come from nix-shell when not already available (e.g. inside
|
|
# a Docker build or an existing nix-shell).
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
run_with_cgo_deps() {
|
|
if command -v pkg-config >/dev/null 2>&1; then
|
|
sh -c "$1"
|
|
else
|
|
nix-shell -p pkg-config vips libheif git --run "$1"
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
echo "Running tests..."
|
|
# Run without -v first for clean output on success; on failure rerun
|
|
# with -v for full diagnostics, then exit non-zero (REPO_POLICIES.md
|
|
# conditional-verbose-rerun pattern). The first run already proved the
|
|
# tests broken, so the build fails even if the rerun happens to pass.
|
|
run_with_cgo_deps "CGO_ENABLED=1 go test -timeout 30s -race -cover ./... || { echo '--- Rerunning with -v for details ---'; CGO_ENABLED=1 go test -timeout 30s -race -v ./...; exit 1; }"
|
|
}
|
|
|
|
main "$@"
|