diff --git a/chainlink-testing-framework/run-tests/action.yml b/chainlink-testing-framework/run-tests/action.yml index c4a2f08..c901bf0 100644 --- a/chainlink-testing-framework/run-tests/action.yml +++ b/chainlink-testing-framework/run-tests/action.yml @@ -203,10 +203,18 @@ inputs: runs: using: composite steps: + - name: Checkout chainlink-testing-framework to use citool + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 + with: + repository: smartcontractkit/chainlink-testing-framework + ref: main + fetch-depth: 0 + path: ctf + # Setup Tools and libraries - name: Setup environment if: inputs.run_setup == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@v2.3.20 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-run-tests-environment@e4dd107855e2359e2d762a48872a3e9365e70f11 # v2.3.30 with: test_download_vendor_packages_command: ${{ inputs.test_download_vendor_packages_command }} go_version: ${{ inputs.go_version }} @@ -328,14 +336,6 @@ runs: shell: bash run: go run ${{ github.action_path }}/mask-testsecrets/main.go "${{ inputs.test_secrets_override_base64 }}" - - name: Checkout chainlink-testing-framework to use citool - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 - with: - repository: smartcontractkit/chainlink-testing-framework - ref: main - fetch-depth: 0 - path: ctf - - name: Create default test config override if: inputs.test_config_override_base64 == '' shell: bash diff --git a/chainlink-testing-framework/setup-go/action.yml b/chainlink-testing-framework/setup-go/action.yml index 50b3dc0..68fbf66 100644 --- a/chainlink-testing-framework/setup-go/action.yml +++ b/chainlink-testing-framework/setup-go/action.yml @@ -1,10 +1,6 @@ name: setup-go description: Common golang setup inputs: - test_download_vendor_packages_command: - required: false - description: The command to download the go modules - default: make download go_version: required: false description: Go version to install @@ -16,9 +12,13 @@ inputs: required: false description: Only restore the cache, set to true if you want to restore and save on cache hit miss default: "false" + cache_builds: + required: false + description: Cache go builds + default: "false" cache_key_id: required: true - description: Cache go vendors unique id + description: Cache key id no_cache: required: false description: Do not use a go cache @@ -27,6 +27,9 @@ inputs: required: false description: Should we check go mod tidy default: "true" + test_download_vendor_packages_command: + required: false + description: The command to download the go modules runs: using: composite @@ -39,31 +42,43 @@ runs: check-latest: true cache: false - - name: Cache Vendor Packages + - name: Set go cache keys + shell: bash + id: go-cache-dir + run: | + echo "gomodcache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT + echo "gobuildcache=$(go env GOCACHE)" >> $GITHUB_OUTPUT + + - name: Cache Go Modules if: inputs.cache_restore_only == 'false' && inputs.no_cache == 'false' uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 id: cache-packages with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - ~/go/bin - key: ${{ runner.os }}-${{ inputs.cache_key_id }}-${{ hashFiles('**/go.sum') }} + path: ${{ steps.go-cache-dir.outputs.gomodcache }} + key: ${{ runner.os }}-${{ inputs.cache_key_id }}-gomod-${{ hashFiles(inputs.go_mod_path) }} + restore-keys: | + ${{ runner.os }}-${{ inputs.cache_key_id }}-gomod- + + - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + if: inputs.cache_restore_only == 'false' && inputs.cache_builds == 'true' + name: Cache Go Builds + with: + path: ${{ steps.go-cache-dir.outputs.gobuildcache }} + # The lifetime of go build outputs is pretty short, so we make our primary cache key be the branch name + key: ${{ runner.os }}-${{ inputs.cache_key_id }}-gobuild-${{ hashFiles(inputs.go_mod_path) }} restore-keys: | - ${{ runner.os }}-${{ inputs.cache_key_id }}- + ${{ runner.os }}-${{ inputs.cache_key_id }}-gobuild- - - name: Restore Cache Vendor Packages + - name: Restore Go Modules if: inputs.cache_restore_only != 'false' && inputs.no_cache == 'false' uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 id: restore-cache-packages with: path: | - ~/.cache/go-build - ~/go/pkg/mod - ~/go/bin - key: ${{ runner.os }}-${{ inputs.cache_key_id }}-${{ hashFiles('**/go.sum') }} + ${{ steps.go-cache-dir.outputs.gomodcache }} + key: ${{ runner.os }}-${{ inputs.cache_key_id }}-gomod-${{ hashFiles(inputs.go_mod_path) }} restore-keys: | - ${{ runner.os }}-${{ inputs.cache_key_id }}- + ${{ runner.os }}-${{ inputs.cache_key_id }}-gomod- - name: Tidy and check files if: ${{ inputs.should_tidy == 'true' }} @@ -71,6 +86,7 @@ runs: with: go_mod_path: ${{ inputs.go_mod_path }} - - name: Download Go Vendor Packages + - name: Run go mod download + if: inputs.test_download_vendor_packages_command shell: bash - run: ${{ inputs.test_download_vendor_packages_command }} + run: ${{ inputs.test_download_vendor_packages_command }} \ No newline at end of file diff --git a/chainlink-testing-framework/setup-run-tests-environment/action.yml b/chainlink-testing-framework/setup-run-tests-environment/action.yml index 0da2a31..e86493d 100644 --- a/chainlink-testing-framework/setup-run-tests-environment/action.yml +++ b/chainlink-testing-framework/setup-run-tests-environment/action.yml @@ -61,15 +61,15 @@ runs: # Go setup and caching - name: Setup Go if: inputs.go_necessary == 'true' - uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@v2.3.14 + uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/setup-go@e4dd107855e2359e2d762a48872a3e9365e70f11 # v2.3.30 with: - test_download_vendor_packages_command: ${{ inputs.test_download_vendor_packages_command }} go_version: ${{ inputs.go_version }} go_mod_path: ${{ inputs.go_mod_path }} cache_restore_only: ${{ inputs.cache_restore_only }} cache_key_id: ${{ inputs.cache_key_id }} should_tidy: ${{ inputs.should_tidy }} no_cache: ${{ inputs.no_cache }} + test_download_vendor_packages_command: ${{ inputs.test_download_vendor_packages_command }} # Setup AWS cred and K8s context - name: Configure AWS Credentials