Skip to content

Commit

Permalink
[TT-519] Cache Fixes To Reduce Total Cache Of Repo (#10232)
Browse files Browse the repository at this point in the history
reverts changes to unit test caching
  • Loading branch information
tateexon authored Aug 17, 2023
1 parent aaa0736 commit db450ec
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 17 deletions.
7 changes: 2 additions & 5 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ inputs:
only-modules:
description: Set to 'true' to only cache modules
default: 'false'
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 Down Expand Up @@ -39,9 +36,9 @@ runs:
${{ 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.matrix-id }}-${{ inputs.cache-version }}-${{ hashFiles('./go.sum') }}
key: ${{ runner.os }}-gomod-${{ inputs.cache-version }}-${{ hashFiles('./go.sum') }}
restore-keys: |
${{ runner.os }}-gomod-${{ inputs.matrix-id }}-${{ inputs.cache-version }}-
${{ runner.os }}-gomod-${{ inputs.cache-version }}-
- uses: actions/cache@v3
if: ${{ inputs.only-modules == 'false' }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ jobs:
prod: "true"
- name: Setup Go
uses: ./.github/actions/setup-go
with:
matrix-id: ${{ matrix.cmd }}-${{ matrix.split.id }}
- name: Setup Solana
uses: ./.github/actions/setup-solana
- name: Setup wasmd
Expand Down
47 changes: 37 additions & 10 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/[email protected].8
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
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 @@ -190,19 +190,21 @@ jobs:
publish_check_name: EVM Smoke Test Results ${{ matrix.product.name }}
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
matrix_id: ${{ matrix.product.name }}
cache_key_id: core-e2e
cache_restore_only: 'true'
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}

## 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/[email protected].8
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
with:
test_download_vendor_packages_command: cd ./integration-tests && go mod download
go_mod_path: ./integration-tests/go.mod
matrix_id: ${{ matrix.product.name }}
cache_key_id: core-e2e
cache_restore_only: 'true'
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
Expand Down Expand Up @@ -390,7 +392,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/[email protected].8
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
env:
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
PYROSCOPE_ENVIRONMENT: ${{ matrix.product.pyroscope_env }}
Expand All @@ -405,18 +407,20 @@ jobs:
publish_check_name: EVM Smoke Test Results ${{ matrix.product.name }}
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
matrix_id: ${{ matrix.product.name }}
cache_key_id: core-e2e
cache_restore_only: 'true'
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
## 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/[email protected].8
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
with:
test_download_vendor_packages_command: cd ./integration-tests && go mod download
go_mod_path: ./integration-tests/go.mod
matrix_id: ${{ matrix.product.name }}
cache_key_id: core-e2e
cache_restore_only: 'true'
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
Expand Down Expand Up @@ -459,6 +463,26 @@ jobs:
hostname: ${{ secrets.GRAFANA_CLOUD_HOST }}
this-job-name: ETH Smoke Tests
continue-on-error: true

# Run the setup if the matrix finishes but this time save the cache if we have a cache hit miss
# this will also only run if both of the matrix jobs pass
eth-smoke-go-mod-cache:
environment: integration
needs: [eth-smoke-tests]
runs-on: ubuntu-latest
name: ETH Smoke Tests Go Mod Cache
steps:
- name: Checkout the repo
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
- name: Run Setup
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected]
with:
test_download_vendor_packages_command: cd ./integration-tests && go mod download
go_mod_path: ./integration-tests/go.mod
cache_key_id: core-e2e
cache_restore_only: 'false'

### Migration tests
node-migration-tests:
Expand Down Expand Up @@ -734,14 +758,15 @@ jobs:
ref: ${{ needs.get_solana_sha.outputs.sha }}
- name: Run Tests
if: needs.changes.outputs.src == 'true'
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].7
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
with:
test_command_to_run: export ENV_JOB_IMAGE=${{ secrets.QA_AWS_ACCOUNT_NUMBER }}.dkr.ecr.${{ secrets.QA_AWS_REGION }}.amazonaws.com/chainlink-solana-tests:${{ needs.get_solana_sha.outputs.sha }} && make test_smoke
cl_repo: ${{ env.CHAINLINK_IMAGE }}
cl_image_tag: ${{ github.sha }}${{ matrix.image.tag-suffix }}
artifacts_location: /home/runner/work/chainlink-solana/chainlink-solana/integration-tests/logs
publish_check_name: Solana Smoke Test Results
go_mod_path: ./integration-tests/go.mod
cache_key_id: core-e2e
token: ${{ secrets.GITHUB_TOKEN }}
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
Expand Down Expand Up @@ -796,7 +821,7 @@ jobs:
ref: ${{ github.event.pull_request.head.sha || github.event.merge_group.head_sha }}
## Only run OCR smoke test for now
- name: Run Tests
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].7
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected].9
env:
PYROSCOPE_SERVER: ${{ secrets.QA_PYROSCOPE_INSTANCE }}
PYROSCOPE_ENVIRONMENT: ci-smoke-ocr-evm-${{ matrix.testnet }} # TODO: Only for OCR for now
Expand All @@ -811,6 +836,8 @@ jobs:
publish_check_name: ${{ matrix.testnet }} OCR Smoke Test Results
token: ${{ secrets.GITHUB_TOKEN }}
go_mod_path: ./integration-tests/go.mod
cache_key_id: core-e2e
cache_restore_only: 'true'
QA_AWS_REGION: ${{ secrets.QA_AWS_REGION }}
QA_AWS_ROLE_TO_ASSUME: ${{ secrets.QA_AWS_ROLE_TO_ASSUME }}
QA_KUBECONFIG: ${{ secrets.QA_KUBECONFIG }}
Expand Down

0 comments on commit db450ec

Please sign in to comment.