Skip to content

Commit ee5a60f

Browse files
committed
Workaround actions/cache@v4 save-always not working as expected
1 parent 01c61dc commit ee5a60f

File tree

2 files changed

+364
-156
lines changed

2 files changed

+364
-156
lines changed

.github/workflows/templates/test-make.template.yaml

+14-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
test-(@= name @):
1414
name: Test (@= name @)
1515
needs: #@ needs
16-
runs-on: ubuntu-20.04
16+
runs-on: ubuntu-latest
1717
strategy:
1818
fail-fast: false
1919
matrix:
@@ -39,15 +39,14 @@
3939
key: ${{ runner.os }}-make-cache-${{ needs.xref.outputs.hash }}
4040
fail-on-cache-miss: true
4141
- name: RESTORE TEST RESULT CACHE
42-
uses: actions/cache@v4
42+
uses: actions/cache/restore@v4
4343
with:
4444
path: /home/runner/test-result-cache/
4545
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ github.run_attempt }}
4646
restore-keys: |
4747
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ needs.xref.outputs.previous_run_attempt }}
4848
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-
4949
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-
50-
save-always: true
5150
- name: PRINT CACHED RESULTS
5251
run: |
5352
set -x
@@ -99,6 +98,11 @@
9998
touch ${{ env.SUCCESS_PATH }}/ct-(@= suite @)
10099
fi
101100
#@ end
101+
- name: SAVE TEST RESULT CACHE
102+
uses: actions/cache/save@v4
103+
with:
104+
path: /home/runner/test-result-cache/
105+
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-(@= name @)-${{ github.run_number }}-${{ github.run_attempt }}
102106
- name: UPLOAD TEST ARTIFACTS
103107
if: always()
104108
uses: actions/[email protected]
@@ -111,7 +115,7 @@
111115
test-rabbitmq_cli:
112116
name: Test rabbitmq_cli
113117
needs: #@ needs
114-
runs-on: ubuntu-20.04
118+
runs-on: ubuntu-latest
115119
strategy:
116120
fail-fast: false
117121
matrix:
@@ -131,15 +135,14 @@
131135
key: ${{ runner.os }}-make-cache-${{ needs.xref.outputs.hash }}
132136
fail-on-cache-miss: true
133137
- name: RESTORE TEST RESULT CACHE
134-
uses: actions/cache@v4
138+
uses: actions/cache/restore@v4
135139
with:
136140
path: /home/runner/test-result-cache/
137141
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ github.run_attempt }}
138142
restore-keys: |
139143
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ needs.xref.outputs.previous_run_attempt }}
140144
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-
141145
${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-
142-
save-always: true
143146
- name: PRINT CACHED RESULTS
144147
run: |
145148
set -x
@@ -164,6 +167,11 @@
164167
RABBITMQ_METADATA_STORE=${{ matrix.metadata_store }}
165168
touch ${{ env.SUCCESS_PATH }}/checks
166169
fi
170+
- name: SAVE TEST RESULT CACHE
171+
uses: actions/cache/save@v4
172+
with:
173+
path: /home/runner/test-result-cache/
174+
key: ${{ runner.os }}-test-result-cache-${{ needs.xref.outputs.hash }}-rabbitmq_cli-${{ github.run_number }}-${{ github.run_attempt }}
167175
- name: UPLOAD TEST ARTIFACTS
168176
if: always()
169177
uses: actions/[email protected]

0 commit comments

Comments
 (0)