Run the checks again on every script/cibuild (closes #54)
check / check (push) Failing after 1s
check / check (push) Failing after 1s
On an unchanged tree docker served every check step of the Dockerfile from its build cache, so a second script/cibuild ran no lint, tests or build and still succeeded. script/cibuild now passes the current time as the CHECK_EPOCH build argument. The lint and build stages each declare it after their module download and before `COPY . .`. A build argument whose value changes makes every RUN step after its declaration miss the cache, so the checks run on each build while the base images, the apk install and the module downloads stay cached. Model: opus-5-5
This commit is contained in:
@@ -6,6 +6,11 @@ WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# script/cibuild sets CHECK_EPOCH to the current time, so the RUN steps
|
||||
# below run again on each build, an unchanged tree included, while the
|
||||
# steps above stay cached. ARG is per stage: the build stage declares it too.
|
||||
ARG CHECK_EPOCH
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make fmt-check
|
||||
@@ -25,6 +30,9 @@ WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# As in the lint stage: the RUN steps below run again on each script/cibuild.
|
||||
ARG CHECK_EPOCH
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN make test
|
||||
|
||||
Reference in New Issue
Block a user