Skip to content

Commit

Permalink
[TT-519] Matrix Go Cache Key Collision Fix (#10211)
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon authored Aug 15, 2023
1 parent 9550be0 commit 1c0af79
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
14 changes: 5 additions & 9 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ inputs:
only-modules:
description: Set to 'true' to only cache modules
default: 'false'
cache-go-modules:
description: |
Option to cache go modules
In matrix jobs the caching will fail in all but the first one to complete and
in doing so it will waste time in the pipeline
default: 'true'
matrix-id:
description: Job caches can have key collisions when used in a matrix so we need to pass a unique id in for these cases
default: "1"
cache-version:
description: Set this to cache bust
default: "1"
Expand All @@ -36,16 +33,15 @@ runs:
echo "gobuildcache=$(go env GOCACHE)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
if: ${{ inputs.cache-go-modules == 'true' }}
name: Cache Go Modules
with:
path: |
${{ steps.go-cache-dir.outputs.gomodcache }}
# The lifetime of go modules is much higher than the build outputs, so we increase cache efficiency
# here by not having the primary key contain the branch name
key: ${{ runner.os }}-gomod-${{ inputs.cache-version }}-${{ hashFiles('./go.sum') }}
key: ${{ runner.os }}-gomod-${{ inputs.matrix-id }}-${{ inputs.cache-version }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-${{ inputs.cache-version }}-
${{ runner.os }}-gomod-${{ inputs.matrix-id }}-${{ inputs.cache-version }}-
- uses: actions/cache@v3
if: ${{ inputs.only-modules == 'false' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
- name: Setup Go
uses: ./.github/actions/setup-go
with:
cache-go-modules: ${{ contains(matrix.split.id, '1/') }}
matrix-id: ${{ matrix.cmd }}-${{ matrix.split.id }}
- name: Setup Solana
uses: ./.github/actions/setup-solana
- name: Setup wasmd
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ jobs:
## Run this step when changes that require tests to be run are made
- name: Run Tests
if: needs.changes.outputs.src == 'true'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@v2.2.7
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/run-tests@v2.2.8
env:
TESTCONTAINERS_RYUK_DISABLED: true
PYROSCOPE_SERVER: ${{ matrix.product.pyroscope_env == '' && '' || !startsWith(github.ref, 'refs/tags/') && '' || secrets.QA_PYROSCOPE_INSTANCE }} # Avoid sending blank envs https://github.com/orgs/community/discussions/25725
Expand All @@ -198,7 +198,7 @@ jobs:
## Run this step when changes that do not need the test to run are made
- name: Run Setup
if: needs.changes.outputs.src == 'false'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@v2.2.6
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@v2.2.8
with:
test_download_vendor_packages_command: cd ./integration-tests && go mod download
go_mod_path: ./integration-tests/go.mod
Expand Down

0 comments on commit 1c0af79

Please sign in to comment.