Skip to content

Commit 0eac708

Browse files
committed
CI: Add strict cache key matching on master builds
1 parent 6534a24 commit 0eac708

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/build-fp-modules.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ on:
3434
description: Size of the cache uncompressed
3535
type: string
3636
required: true
37+
strict-cache-key-matching:
38+
description: Only allow to restore a specific cache or build from scratch if no match
39+
default: false
40+
type: boolean
3741
env:
3842
PROJECT_OPTIONS: target_arch ${{ inputs.arch }}
3943
jobs:
@@ -65,8 +69,7 @@ jobs:
6569
with:
6670
server-quota-high: ${{ inputs.max-uncompressed-cache-size }}
6771
key: ${{ inputs.cache-key-prefix }}${{ inputs.cache-key-hash }}
68-
restore-keys: |
69-
${{ inputs.cache-key-prefix }}
72+
restore-keys: ${{ inputs.strict-cache-key-matching && null || inputs.cache-key-prefix }}
7073

7174
- name: Build ${{ inputs.element }}
7275
id: build

.github/workflows/push.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
uses: ./.github/workflows/build-project.yaml
1818
with:
1919
arches: '["x86_64", "aarch64"]'
20+
strict-cache-key-matching: ${{ github.ref == 'refs/heads/master' }}
2021
upload-artifacts: ${{ github.ref == 'refs/heads/master' }}
2122

2223
check-code:

0 commit comments

Comments
 (0)