From 91fd6fa7944e5c39e20b0d332037330d07f0b4a5 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Mon, 30 Mar 2026 19:37:09 +0200 Subject: [PATCH 1/3] ci: optimize Go and Docker layer caching across CI workflows - Fix apps/testapp/Dockerfile: copy go.mod/go.sum before source so the go mod download layer is stable across code-only changes - Add cache-from/cache-to GHA cache to docker-build-push.yml with per-app scopes to prevent cache eviction between parallel builds - Add cache-dependency-path: "**/go.sum" to all actions/setup-go steps in test.yml, docker-tests.yml, and lint.yml so the module cache key covers all go.sum files in the multi-module repo - Add explicit scope to the e2e Docker build cache in test.yml to align with the docker-build-push.yml scope naming Closes #3196 Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/docker-build-push.yml | 2 ++ .github/workflows/docker-tests.yml | 3 +++ .github/workflows/lint.yml | 1 + .github/workflows/test.yml | 10 ++++++++-- apps/testapp/Dockerfile | 11 +++++++---- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index c9595d6b0f..187fb8a80d 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -48,3 +48,5 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: ghcr.io/${{ github.repository_owner }}/${{ matrix.app.name }}:${{ inputs.image-tag }} + cache-from: type=gha,scope=${{ matrix.app.name }} + cache-to: type=gha,mode=max,scope=${{ matrix.app.name }} diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml index c874b5e159..f584e38fcc 100644 --- a/.github/workflows/docker-tests.yml +++ b/.github/workflows/docker-tests.yml @@ -27,6 +27,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./test/docker-e2e/go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Run Docker E2E Tests @@ -46,6 +47,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./test/docker-e2e/go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Run Docker Upgrade E2E Tests @@ -65,6 +67,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./test/docker-e2e/go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Run Docker Compat E2E Tests diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8ee4a6417a..8fff166cbd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,6 +16,7 @@ jobs: - uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" # This steps sets the GIT_DIFF environment variable to true # if files defined in PATTERS changed - uses: technote-space/get-diff-action@v6.1.2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aea8dee0e2..cd9ef7118d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,6 +17,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Build all ev-node binaries @@ -30,6 +31,7 @@ jobs: - uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - uses: extractions/setup-just@v3 - run: just deps - name: check for diff @@ -47,6 +49,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Run unit test @@ -66,6 +69,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: Run integration test @@ -89,6 +93,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v4 - name: Build evstack:local-dev (cached) @@ -98,8 +103,8 @@ jobs: file: apps/testapp/Dockerfile load: true tags: evstack:local-dev - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=gha,scope=ev-node-testapp + cache-to: type=gha,mode=max,scope=ev-node-testapp - name: Install just uses: extractions/setup-just@v3 - name: E2E Tests @@ -115,6 +120,7 @@ jobs: uses: actions/setup-go@v6.3.0 with: go-version-file: ./go.mod + cache-dependency-path: "**/go.sum" - name: Install just uses: extractions/setup-just@v3 - name: EVM Tests diff --git a/apps/testapp/Dockerfile b/apps/testapp/Dockerfile index fe3701947c..0e080c3ba4 100644 --- a/apps/testapp/Dockerfile +++ b/apps/testapp/Dockerfile @@ -17,11 +17,14 @@ FROM base AS builder WORKDIR /ev-node -# Copy all source code first -COPY . . +# Copy module files first to leverage Docker layer caching. +# Dependencies are only re-downloaded when go.mod or go.sum change. +COPY go.mod go.sum ./ +RUN go mod download -# Now download dependencies and build -RUN go mod download && cd apps/testapp && go install . +# Copy the rest of the source and build. +COPY . . +RUN cd apps/testapp && go install . ## prep the final image. # From ee1e01748feb8a9f1972a878b1ddb9f319a8cc0a Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Mon, 30 Mar 2026 19:46:22 +0200 Subject: [PATCH 2/3] fix(ci): copy testapp go.mod/go.sum before download, fix hadolint warnings Also copy apps/testapp/go.mod and apps/testapp/go.sum before running go mod download so the testapp's own dependencies are cached in their own layer (separate from the root module). Replace RUN cd ... && go install with WORKDIR + go build to resolve hadolint DL3003 and DL3062. Co-Authored-By: Claude Sonnet 4.6 --- apps/testapp/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/testapp/Dockerfile b/apps/testapp/Dockerfile index 0e080c3ba4..c92cdf56e4 100644 --- a/apps/testapp/Dockerfile +++ b/apps/testapp/Dockerfile @@ -20,11 +20,14 @@ WORKDIR /ev-node # Copy module files first to leverage Docker layer caching. # Dependencies are only re-downloaded when go.mod or go.sum change. COPY go.mod go.sum ./ -RUN go mod download +COPY apps/testapp/go.mod apps/testapp/go.sum ./apps/testapp/ +RUN go mod download && (cd apps/testapp && go mod download) # Copy the rest of the source and build. COPY . . -RUN cd apps/testapp && go install . + +WORKDIR /ev-node/apps/testapp +RUN go build -o /go/bin/testapp . ## prep the final image. # From 7e08c9d98c18d6539538a0ad4f6174720f934607 Mon Sep 17 00:00:00 2001 From: tac0turtle Date: Tue, 31 Mar 2026 19:38:42 +0200 Subject: [PATCH 3/3] bump docker go versions --- apps/evm/Dockerfile | 2 +- apps/grpc/Dockerfile | 2 +- apps/testapp/Dockerfile | 2 +- tools/local-da/Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/evm/Dockerfile b/apps/evm/Dockerfile index 009111fce8..5d04211a99 100644 --- a/apps/evm/Dockerfile +++ b/apps/evm/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25-alpine AS build-env +FROM golang:1.26-alpine AS build-env WORKDIR /src diff --git a/apps/grpc/Dockerfile b/apps/grpc/Dockerfile index e926eadfaa..919b894d96 100644 --- a/apps/grpc/Dockerfile +++ b/apps/grpc/Dockerfile @@ -1,5 +1,5 @@ # Build stage -FROM golang:1.25-alpine AS builder +FROM golang:1.26-alpine AS builder #hadolint ignore=DL3018 RUN apk add --no-cache git gcc musl-dev linux-headers diff --git a/apps/testapp/Dockerfile b/apps/testapp/Dockerfile index c92cdf56e4..d2be1823cb 100644 --- a/apps/testapp/Dockerfile +++ b/apps/testapp/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25 AS base +FROM golang:1.26 AS base #hadolint ignore=DL3018 RUN apt-get update && \ diff --git a/tools/local-da/Dockerfile b/tools/local-da/Dockerfile index 134eeaa6b1..e583909f32 100644 --- a/tools/local-da/Dockerfile +++ b/tools/local-da/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.25-alpine AS build-env +FROM golang:1.26-alpine AS build-env WORKDIR /src