-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update chainlink-testing-framework/setup-go and chainlink-testing-fra…
…mework/run-tests actions (#191) * Update caching in setup-go GHA Update caching and use go.mod instead of go.sum as hashFile as discussed in actions/setup-go#478 (comment) * Remove cache_key_id and use cache_version This makes sure that the same cache key is used everywhere unless cache_version is changed. * Remove download mods step This is unnecessary step. The mods are downloaded anyway and then cached at the end of a job * Do not cache go builds by default Go builds can be fast and do not rely on network. This will reduce cache size. * Restore cache_key_id * Update related GHA * Use local actions for run-tests * Update cache keys * Fix * Revert using local actions * Bump * Fix * Bring back test_download_vendor_packages_command * Remove cache_version as cache_key_id can include this * Make test_download_vendor_packages_command optional * Bump * Bump
- Loading branch information
Showing
3 changed files
with
47 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected].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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,38 +42,51 @@ 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' }} | ||
uses: smartcontractkit/chainlink-github-actions/chainlink-testing-framework/[email protected] | ||
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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/[email protected].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 | ||
|