File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,7 +164,9 @@ jobs:
164164 uses : actions/cache/restore@v5
165165 with :
166166 path : nimcache
167- key : nimcache-test_all-${{ matrix.platform.os }}-${{ matrix.platform.cpu }}-${{ matrix.platform.cc }}-${{ matrix.nim.ref }}-${{ matrix.nim.memory_management }}
167+ key : nimcache-test_all-${{ matrix.platform.os }}-${{ matrix.platform.cpu }}-${{ matrix.platform.cc }}-${{ matrix.nim.ref }}-${{ matrix.nim.memory_management }}-${{ github.run_id }}
168+ restore-keys : |
169+ nimcache-test_all-${{ matrix.platform.os }}-${{ matrix.platform.cpu }}-${{ matrix.platform.cc }}-${{ matrix.nim.ref }}-${{ matrix.nim.memory_management }}
168170
169171 - name : Build test_all
170172 id : build-test-all
@@ -193,6 +195,17 @@ jobs:
193195 path : nimcache
194196 key : ${{ steps.nimcache-restore.outputs.cache-primary-key }}
195197
198+ - name : Prune old nimcache entries
199+ if : github.ref_name == 'master'
200+ env :
201+ GH_TOKEN : ${{ github.token }}
202+ run : |
203+ PREFIX="nimcache-test_all-${{ matrix.platform.os }}-${{ matrix.platform.cpu }}-${{ matrix.platform.cc }}-${{ matrix.nim.ref }}-${{ matrix.nim.memory_management }}"
204+ KEEP="${{ steps.nimcache-restore.outputs.cache-primary-key }}"
205+ gh cache list --ref "${{ github.ref }}" --limit 100 --json id,key \
206+ --jq ".[] | select(.key | startswith(\"$PREFIX\")) | select(.key != \"$KEEP\") | .id" \
207+ | xargs -r -n1 gh cache delete
208+
196209 - name : Run tests
197210 id : run-tests
198211 run : |
You can’t perform that action at this time.
0 commit comments