Skip to content

Commit

Permalink
[TT-519] Cache using the go.sum file of the test project
Browse files Browse the repository at this point in the history
  • Loading branch information
tateexon committed Aug 23, 2023
1 parent 395ee22 commit f719640
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/cleanup-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ jobs:
steps:
- name: Check out Code
uses: actions/checkout@v3
- name: test
id: tester
run: |
echo "path=./LICENSE" >> $GITHUB_ENV
- run: |
echo "This is a test ${{ hashFiles('${{steps.tester.ouputs.path}}') }}"
- name: cleanup with cancel
if: always()
id: did_skip
Expand Down
15 changes: 14 additions & 1 deletion chainlink-testing-framework/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ runs:
go-version-file: ${{ inputs.go_mod_path }}
check-latest: true

- name: Get sum path from mod
id: sum-path
shell: bash
run: |
# get the base path for the go test project
TEST_LIB_PATH="${{ inputs.go_mod_path }}"
if [ "${#TEST_LIB_PATH}" -gt "6" ]; then
TEST_LIB_PATH=${TEST_LIB_PATH%go.mod}
echo "path=${TEST_LIB_PATH}" >> $GITHUB_ENV
else
echo "path=./" >> $GITHUB_ENV
fi
- name: Cache Vendor Packages
if: inputs.cache_restore_only == 'false'
uses: actions/cache@v3
Expand All @@ -39,7 +52,7 @@ runs:
~/.cache/go-build
~/go/pkg/mod
~/go/bin
key: ${{ runner.os }}-${{ inputs.cache_key_id }}-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-${{ inputs.cache_key_id }}-${{ hashFiles('${{ steps.sum-path.outputs.path}}/go.sum') }}
restore-keys: |
${{ runner.os }}-${{ inputs.cache_key_id }}-
Expand Down

0 comments on commit f719640

Please sign in to comment.