Skip to content

Commit 7a0f6bf

Browse files
Copilotjohnpatek
andcommitted
fix: use jq hash of deps+vcpkg ref for precise cache keying
Co-authored-by: johnpatek <31934875+johnpatek@users.noreply.github.com> Agent-Logs-Url: https://github.com/maxtek6/WebFrame/sessions/fb217989-1474-4e1b-9ac5-e89043f9f671
1 parent 47430ac commit 7a0f6bf

1 file changed

Lines changed: 25 additions & 8 deletions

File tree

.github/workflows/main.yml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ permissions:
77
contents: write
88
packages: write
99

10+
env:
11+
VCPKG_REF: '2026.01.16'
12+
1013
jobs:
1114
test:
1215
name: Unit Tests
@@ -20,7 +23,7 @@ jobs:
2023
with:
2124
repository: microsoft/vcpkg
2225
path: vcpkg
23-
ref: '2026.01.16'
26+
ref: ${{ env.VCPKG_REF }}
2427

2528
- name: Checkout code
2629
uses: actions/checkout@v6
@@ -29,13 +32,20 @@ jobs:
2932
path: WebFrame
3033
ref: ${{ github.ref }}
3134

35+
- name: Compute vcpkg cache hash
36+
id: vcpkg-hash
37+
shell: bash
38+
run: |
39+
hash=$(jq -cj '{features,dependencies}' WebFrame/vcpkg.json | cat - WebFrame/vcpkg-configuration.json | sha256sum | awk '{print $1}')
40+
echo "value=${hash}" >> $GITHUB_OUTPUT
41+
3242
- name: "Restore VCPKG cache"
3343
id: restore-test-cache
3444
uses: actions/cache/restore@v4
3545
with:
3646
path: ${{ github.workspace }}/vcpkg-test-cache
37-
key: vcpkg-test-cache-${{ hashFiles('WebFrame/vcpkg.json', 'WebFrame/vcpkg-configuration.json') }}
38-
restore-keys: vcpkg-test-cache
47+
key: vcpkg-test-cache-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}
48+
restore-keys: vcpkg-test-cache-${{ env.VCPKG_REF }}
3949

4050
- name: CMake Build
4151
run: |
@@ -49,7 +59,7 @@ jobs:
4959
uses: actions/cache/save@v4
5060
with:
5161
path: ${{ github.workspace }}/vcpkg-test-cache
52-
key: vcpkg-test-cache-${{ hashFiles('WebFrame/vcpkg.json', 'WebFrame/vcpkg-configuration.json') }}
62+
key: vcpkg-test-cache-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}
5363

5464
build:
5565
needs: test
@@ -68,7 +78,7 @@ jobs:
6878
with:
6979
repository: microsoft/vcpkg
7080
path: vcpkg
71-
ref: '2026.01.16'
81+
ref: ${{ env.VCPKG_REF }}
7282

7383
- name: Checkout code
7484
uses: actions/checkout@v6
@@ -77,13 +87,20 @@ jobs:
7787
path: WebFrame
7888
ref: ${{ github.ref }}
7989

90+
- name: Compute vcpkg cache hash
91+
id: vcpkg-hash
92+
shell: bash
93+
run: |
94+
hash=$(jq -cj '{features,dependencies}' WebFrame/vcpkg.json | cat - WebFrame/vcpkg-configuration.json | sha256sum | awk '{print $1}')
95+
echo "value=${hash}" >> $GITHUB_OUTPUT
96+
8097
- name: "Restore VCPKG cache"
8198
id: restore-build-cache
8299
uses: actions/cache/restore@v5
83100
with:
84101
path: ${{ github.workspace }}/vcpkg-${{ matrix.os }}
85-
key: vcpkg-${{ matrix.os }}-${{ hashFiles('WebFrame/vcpkg.json', 'WebFrame/vcpkg-configuration.json') }}
86-
restore-keys: vcpkg-${{ matrix.os }}
102+
key: vcpkg-${{ matrix.os }}-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}
103+
restore-keys: vcpkg-${{ matrix.os }}-${{ env.VCPKG_REF }}
87104

88105
- name: Ubuntu setup
89106
if: matrix.os == 'ubuntu-latest'
@@ -103,4 +120,4 @@ jobs:
103120
uses: actions/cache/save@v5
104121
with:
105122
path: ${{ github.workspace }}/vcpkg-${{ matrix.os }}
106-
key: vcpkg-${{ matrix.os }}-${{ hashFiles('WebFrame/vcpkg.json', 'WebFrame/vcpkg-configuration.json') }}
123+
key: vcpkg-${{ matrix.os }}-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}

0 commit comments

Comments
 (0)