next #152
@@ -2,6 +2,7 @@
|
|||||||
# The linter is invoked directly rather than through `make lint`: that
|
# The linter is invoked directly rather than through `make lint`: that
|
||||||
# target shells out to `docker build -f Dockerfile.lint`, and there is
|
# target shells out to `docker build -f Dockerfile.lint`, and there is
|
||||||
# no docker daemon inside a docker build.
|
# no docker daemon inside a docker build.
|
||||||
|
# script/cibuild and script/docker name this stage in --no-cache-filter.
|
||||||
# golangci/golangci-lint:v2.12.2 (Debian-based), 2026-08-10
|
# golangci/golangci-lint:v2.12.2 (Debian-based), 2026-08-10
|
||||||
FROM golangci/golangci-lint:v2.12.2@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240 AS lint
|
FROM golangci/golangci-lint:v2.12.2@sha256:5cceeef04e53efe1470638d4b4b4f5ceefd574955ab3941b2d9a68a8c9ad5240 AS lint
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ RUN make fmt-check
|
|||||||
RUN golangci-lint run --config .golangci.yml ./...
|
RUN golangci-lint run --config .golangci.yml ./...
|
||||||
|
|
||||||
# Build stage
|
# Build stage
|
||||||
|
# script/cibuild and script/docker name this stage in --no-cache-filter.
|
||||||
# golang 1.25-alpine, 2026-02-28
|
# golang 1.25-alpine, 2026-02-28
|
||||||
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4ced AS builder
|
||||||
|
|
||||||
|
|||||||
@@ -465,9 +465,13 @@ them. We provide:
|
|||||||
- `script/fmt` — format all code (gofmt -s, goimports)
|
- `script/fmt` — format all code (gofmt -s, goimports)
|
||||||
- `script/fmt-check` — check formatting (read-only)
|
- `script/fmt-check` — check formatting (read-only)
|
||||||
- `script/check` — run test, lint, and fmt-check
|
- `script/check` — run test, lint, and fmt-check
|
||||||
- `script/docker` — build the Docker image tagged via
|
- `script/docker` — build the Docker image tagged via `script/projectname`, with
|
||||||
`script/projectname`
|
`--no-cache-filter=lint,builder` so the lint stage and the builder stage,
|
||||||
- `script/cibuild` — CI entrypoint: plain `docker build .`
|
which runs the tests, run on every invocation
|
||||||
|
- `script/cibuild` — CI entrypoint: `docker build` with
|
||||||
|
`--no-cache-filter=lint,builder`, so the lint stage and the builder stage,
|
||||||
|
which runs the tests, run on every invocation, because a cached build lints
|
||||||
|
nothing and queries no DNS
|
||||||
- `script/precommit` — run by the git pre-commit hook; `go mod tidy`
|
- `script/precommit` — run by the git pre-commit hook; `go mod tidy`
|
||||||
guard, then `script/check`
|
guard, then `script/check`
|
||||||
- `script/install-precommit` — install the git pre-commit hook
|
- `script/install-precommit` — install the git pre-commit hook
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ Rationale, Design, TODO, License, Author) if any are still missing.
|
|||||||
|
|
||||||
# Completed Steps
|
# Completed Steps
|
||||||
|
|
||||||
|
- 2026-09-28: `script/cibuild` and `script/docker` now pass
|
||||||
|
`--no-cache-filter=lint,builder` so lint and tests run every build (closes
|
||||||
|
#115).
|
||||||
- 2026-09-28: the server timeout test now drives `Run` and checks the
|
- 2026-09-28: the server timeout test now drives `Run` and checks the
|
||||||
`http.Server` it serves carries the timeouts; corrected the `ReadTimeout`
|
`http.Server` it serves carries the timeouts; corrected the `ReadTimeout`
|
||||||
note in that test (closes #120).
|
note in that test (closes #120).
|
||||||
|
|||||||
+6
-2
@@ -1,14 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/cibuild: run the CI build. The Dockerfile's lint stage runs
|
# script/cibuild: run the CI build. The Dockerfile's lint stage runs
|
||||||
# make fmt-check and golangci-lint; its builder stage runs make test
|
# make fmt-check and golangci-lint; its builder stage runs make test
|
||||||
# and make build. A successful build implies all of those passed.
|
# and make build.
|
||||||
|
#
|
||||||
|
# --no-cache-filter=lint,builder runs both stages on every invocation;
|
||||||
|
# otherwise an unchanged tree is served from the layer cache and passes
|
||||||
|
# without linting or querying live DNS.
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
docker build .
|
docker build --no-cache-filter=lint,builder .
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
+6
-2
@@ -1,6 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# script/docker: build the Docker image tagged with the project name.
|
# script/docker: build the Docker image tagged with the project name.
|
||||||
# Identical in all repos; the tag comes from script/projectname.
|
# The tag comes from script/projectname.
|
||||||
|
#
|
||||||
|
# --no-cache-filter=lint,builder runs the lint stage and the builder
|
||||||
|
# stage (make test) on every invocation; otherwise an unchanged tree is
|
||||||
|
# served from the layer cache without linting or querying live DNS.
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
|
||||||
@@ -8,7 +12,7 @@ ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"
|
|||||||
|
|
||||||
main() {
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
docker build -t "$("$SCRIPT_DIR/projectname")" .
|
docker build --no-cache-filter=lint,builder -t "$("$SCRIPT_DIR/projectname")" .
|
||||||
}
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user