Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update chainlink-testing-framework/setup-go and chainlink-testing-framework/run-tests actions #191

Merged
merged 17 commits into from
Aug 16, 2024
Merged
18 changes: 9 additions & 9 deletions chainlink-testing-framework/run-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
56 changes: 36 additions & 20 deletions chainlink-testing-framework/setup-go/action.yml
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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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/go-mod-tidy@v2.3.6
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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down