From 4c6fa91d700655295d82d7121b4212d95d214794 Mon Sep 17 00:00:00 2001 From: Stephen Lang Date: Mon, 23 Feb 2026 11:48:00 +0000 Subject: [PATCH] feat(CI): reuse Go build cache across workflows Add Go build caching to four additional PR workflows (pull_request, pull_request_integration_tests_arm, pull_request_k8s_integration_tests, pull_request_oats_test, workflow_integration_tests_vm) using the same secure pattern established in pull_request_integration_tests. Cache keys are workflow-specific to avoid invalidation between different test configurations (race vs non-race builds). Co-Authored-By: Claude Haiku 4.5 --- .github/workflows/pull_request.yml | 12 ++++++++++-- .../workflows/pull_request_integration_tests_arm.yml | 12 ++++++++++-- .../workflows/pull_request_k8s_integration_tests.yml | 12 ++++++++++-- .github/workflows/pull_request_oats_test.yml | 12 ++++++++++-- .github/workflows/workflow_integration_tests_vm.yml | 12 ++++++++++-- 5 files changed, 50 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 44c60fc5c8..eaae5b30e0 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -34,10 +34,18 @@ jobs: persist-credentials: false - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: go-version-file: "go.mod" - cache: "false" + cache: true + + - name: Go build cache + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning] go build cache is content-addressable and self-verifying + with: + path: ~/.cache/go-build + key: go-build-pr-race-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.go', 'go.sum') }} + restore-keys: | + go-build-pr-race-${{ runner.os }}-${{ runner.arch }}- - name: Run verification and unit tests run: make docker-generate verify cov-exclude-generated check-go-mod notices-update check-ebpf-ver-synced check-clean-work-tree diff --git a/.github/workflows/pull_request_integration_tests_arm.yml b/.github/workflows/pull_request_integration_tests_arm.yml index fb65442994..10210a63ae 100644 --- a/.github/workflows/pull_request_integration_tests_arm.yml +++ b/.github/workflows/pull_request_integration_tests_arm.yml @@ -118,10 +118,18 @@ jobs: persist-credentials: false - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: go-version-file: "go.mod" - cache: false + cache: true + + - name: Go build cache + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning] go build cache is content-addressable and self-verifying + with: + path: ~/.cache/go-build + key: go-build-integration-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.go', 'go.sum') }} + restore-keys: | + go-build-integration-${{ runner.os }}-${{ runner.arch }}- - name: Generate files run: make prereqs docker-generate diff --git a/.github/workflows/pull_request_k8s_integration_tests.yml b/.github/workflows/pull_request_k8s_integration_tests.yml index d90d309dc3..633fdfa93d 100644 --- a/.github/workflows/pull_request_k8s_integration_tests.yml +++ b/.github/workflows/pull_request_k8s_integration_tests.yml @@ -110,10 +110,18 @@ jobs: persist-credentials: false - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: go-version-file: "go.mod" - cache: false + cache: true + + - name: Go build cache + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning] go build cache is content-addressable and self-verifying + with: + path: ~/.cache/go-build + key: go-build-k8s-integration-race-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.go', 'go.sum') }} + restore-keys: | + go-build-k8s-integration-race-${{ runner.os }}-${{ runner.arch }}- - name: Generate files run: make prereqs docker-generate diff --git a/.github/workflows/pull_request_oats_test.yml b/.github/workflows/pull_request_oats_test.yml index 0b0091aa7b..0ad727c71b 100644 --- a/.github/workflows/pull_request_oats_test.yml +++ b/.github/workflows/pull_request_oats_test.yml @@ -110,10 +110,18 @@ jobs: persist-credentials: false - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: go-version-file: "go.mod" - cache: false + cache: true + + - name: Go build cache + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning] go build cache is content-addressable and self-verifying + with: + path: ~/.cache/go-build + key: go-build-oats-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.go', 'go.sum') }} + restore-keys: | + go-build-oats-${{ runner.os }}-${{ runner.arch }}- - name: Run oats tests env: diff --git a/.github/workflows/workflow_integration_tests_vm.yml b/.github/workflows/workflow_integration_tests_vm.yml index a8ef8fac65..0d8a7d8779 100644 --- a/.github/workflows/workflow_integration_tests_vm.yml +++ b/.github/workflows/workflow_integration_tests_vm.yml @@ -120,10 +120,18 @@ jobs: persist-credentials: false - name: Set up Go - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 # zizmor: ignore[cache-poisoning] go.sum verifies module integrity with: go-version-file: "go.mod" - cache: false + cache: true + + - name: Go build cache + uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3 # zizmor: ignore[cache-poisoning] go build cache is content-addressable and self-verifying + with: + path: ~/.cache/go-build + key: go-build-vm-integration-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('**/*.go', 'go.sum') }} + restore-keys: | + go-build-vm-integration-${{ runner.os }}-${{ runner.arch }}- - name: Generate files run: make prereqs docker-generate