Skip to content

Commit c213f83

Browse files
committed
Add option to control write/read from cache independently
1 parent 41d8301 commit c213f83

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,8 @@ jobs:
176176
runs-on: ${{ needs.setup.outputs.compute-test-go }}
177177
runs-on-small: ${{ needs.setup.outputs.compute-small }}
178178
testonly: true
179-
test-timing-cache-enabled: false
179+
test-timing-cache-restore-enabled: false
180+
test-timing-cache-save-enabled: false
180181
total-runners: 2 # test runners cannot be less than 2
181182
secrets: inherit
182183

.github/workflows/test-go.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,13 @@ on:
6464
required: false
6565
default: false
6666
type: boolean
67-
test-timing-cache-enabled:
68-
description: Cache the gotestsum test timing data.
67+
test-timing-cache-restore-enabled:
68+
description: Restore the gotestsum test timing data from cache.
69+
required: false
70+
default: true
71+
type: boolean
72+
test-timing-cache-save-enabled:
73+
description: Upload the gotestsum test timing data to cache.
6974
required: false
7075
default: true
7176
type: boolean
@@ -139,7 +144,7 @@ jobs:
139144
- uses: ./.github/actions/set-up-gotestsum
140145
- run: mkdir -p ${{ steps.metadata.outputs.go-test-dir }}
141146
- uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
142-
if: inputs.test-timing-cache-enabled
147+
if: inputs.test-timing-cache-restore-enabled || inputs.test-timing-cache-save-enabled
143148
with:
144149
path: ${{ steps.metadata.outputs.go-test-dir }}
145150
key: ${{ inputs.test-timing-cache-key }}-${{ github.run_number }}
@@ -641,20 +646,20 @@ jobs:
641646
echo "test-go-results=${test_go_results}"
642647
} | tee -a "$GITHUB_OUTPUT"
643648
# Aggregate, prune, and cache our timing data
644-
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-enabled }}
649+
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-save-enabled }}
645650
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
646651
with:
647652
path: ${{ needs.test-matrix.outputs.go-test-dir }}
648653
key: ${{ inputs.test-timing-cache-key }}-${{ github.run_number }}
649654
restore-keys: |
650655
${{ inputs.test-timing-cache-key }}-
651-
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-enabled }}
656+
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-save-enabled }}
652657
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
653658
with:
654659
path: ${{ needs.test-matrix.outputs.go-test-dir }}
655660
pattern: ${{ needs.test-go.outputs.go-test-results-download-pattern }}
656661
merge-multiple: true
657-
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-enabled }}
662+
- if: ${{ ! cancelled() && needs.test-go.result == 'success' && inputs.test-timing-cache-save-enabled }}
658663
name: Prune any invalid timing files
659664
run: |
660665
ls -lhR '${{ needs.test-matrix.outputs.go-test-dir }}'

0 commit comments

Comments
 (0)