Skip to content
Merged
23 changes: 0 additions & 23 deletions .github/actions/cache-go-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,12 @@ runs:
id: cache-paths
run: |
echo "GOCACHE=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "GOMODCACHE=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
echo "GOARCH=$(go env GOARCH)" >> "$GITHUB_OUTPUT"
echo "TAG=${{ github.sha }}" >> "$GITHUB_OUTPUT"
suffix="${{ inputs.key-suffix }}"
echo "KEY_SUFFIX=${suffix:+-$suffix}" >> "$GITHUB_OUTPUT" # prepends dash if set
shell: bash

# Save caches only on pushes to the default branch.
# All other events (PRs, etc.) restore only.
- name: Cache Go Dependencies (save)
if: inputs.save == 'true' && (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)
uses: actions/cache@v5
with:
path: ${{ steps.cache-paths.outputs.GOMODCACHE }}
key: go-mod-v1-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod-v1-

- name: Cache Go Dependencies (restore)
if: ${{ !(inputs.save == 'true' && (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)) }}
uses: actions/cache/restore@v5
with:
path: ${{ steps.cache-paths.outputs.GOMODCACHE }}
key: go-mod-v1-${{ hashFiles('**/go.sum') }}
restore-keys: go-mod-v1-

- name: Cache Go Build (save)
if: inputs.save == 'true' && (github.event_name == 'push' && github.ref_name == github.event.repository.default_branch)
uses: actions/cache@v5
Expand Down Expand Up @@ -90,7 +71,3 @@ runs:
find "$gocache" -mindepth 1 -type d -empty -delete 2>/dev/null || true;
after=$(du -sm "$gocache" 2>/dev/null | cut -f1);
echo "GOCACHE trimmed: ${before:-0}MB -> ${after:-0}MB (removed $((${before:-0} - ${after:-0}))MB)"

- name: Download Go modules
run: make deps --always-make
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ jobs:
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- name: Resolve mods for protos
run: go mod tidy
- name: Download scanner module for proto generation
run: go mod download github.com/stackrox/scanner

- name: Generate the swagger docs
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- name: Download scanner module for proto generation
run: go mod download github.com/stackrox/scanner

- name: Check Generated
run: scripts/ci/jobs/check-generated.sh

Expand Down Expand Up @@ -156,6 +159,9 @@ jobs:
- name: Cache Go dependencies
uses: ./.github/actions/cache-go-dependencies

- name: Download scanner module for proto generation
run: go mod download github.com/stackrox/scanner

- name: Cache UI dependencies
uses: ./.github/actions/cache-ui-dependencies

Expand Down
Loading