diff --git a/.github/actions/warm-go-cache/action.yaml b/.github/actions/warm-go-cache/action.yaml new file mode 100644 index 00000000000..8b4a192314c --- /dev/null +++ b/.github/actions/warm-go-cache/action.yaml @@ -0,0 +1,13 @@ +name: 'Warm Go build cache' +description: 'Set GOCACHE and optionally warm from EFS-backed PV' +runs: + using: composite + steps: + - shell: bash + run: | + echo "GOCACHE=/tmp/go-build-cache" >> "$GITHUB_ENV" + if [ -d /cache/go-build ]; then + mkdir -p /tmp/go-build-cache && \ + timeout 120 cp -a /cache/go-build/. /tmp/go-build-cache/ || \ + echo "Warning: failed to copy EFS cache, proceeding without cache" + fi diff --git a/.github/workflows/envtest-kube-reusable.yaml b/.github/workflows/envtest-kube-reusable.yaml index e38fe093c06..f3b2609d655 100644 --- a/.github/workflows/envtest-kube-reusable.yaml +++ b/.github/workflows/envtest-kube-reusable.yaml @@ -49,6 +49,8 @@ jobs: if: needs.changes.outputs.should_run == 'true' runs-on: arc-runner-set timeout-minutes: 15 + env: + GOCACHE: /tmp/go-build-cache strategy: fail-fast: false matrix: @@ -57,6 +59,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + - uses: ./.github/actions/warm-go-cache - run: make test-envtest-kube ENVTEST_KUBE_VERSIONS="${{ matrix.version }}" conclusion: diff --git a/.github/workflows/envtest-ocp-reusable.yaml b/.github/workflows/envtest-ocp-reusable.yaml index 2f001758c43..b487da9b74a 100644 --- a/.github/workflows/envtest-ocp-reusable.yaml +++ b/.github/workflows/envtest-ocp-reusable.yaml @@ -49,6 +49,8 @@ jobs: if: needs.changes.outputs.should_run == 'true' runs-on: arc-runner-set timeout-minutes: 15 + env: + GOCACHE: /tmp/go-build-cache strategy: fail-fast: false matrix: @@ -58,6 +60,7 @@ jobs: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + - uses: ./.github/actions/warm-go-cache - run: make test-envtest-ocp ENVTEST_OCP_K8S_VERSIONS="${{ matrix.version }}" conclusion: diff --git a/.github/workflows/lint-reusable.yaml b/.github/workflows/lint-reusable.yaml index e969b494fa8..8784b8c2403 100644 --- a/.github/workflows/lint-reusable.yaml +++ b/.github/workflows/lint-reusable.yaml @@ -11,6 +11,8 @@ jobs: name: Lint runs-on: arc-runner-set timeout-minutes: 60 + env: + GOCACHE: /tmp/go-build-cache steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: @@ -20,6 +22,7 @@ jobs: if [ -n "${{ github.base_ref }}" ]; then git fetch origin "${{ github.base_ref }}:${{ github.base_ref }}" fi + - uses: ./.github/actions/warm-go-cache - name: Use pre-built lint tools run: | if [ -d /opt/lint-tools ]; then diff --git a/.github/workflows/verify-reusable.yaml b/.github/workflows/verify-reusable.yaml index f543d537bff..c1957a89859 100644 --- a/.github/workflows/verify-reusable.yaml +++ b/.github/workflows/verify-reusable.yaml @@ -11,10 +11,13 @@ jobs: name: Verify runs-on: arc-runner-set timeout-minutes: 60 + env: + GOCACHE: /tmp/go-build-cache steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: persist-credentials: false + - uses: ./.github/actions/warm-go-cache - run: make generate update - run: make staticcheck - run: make fmt