@@ -7,6 +7,9 @@ permissions:
77 contents : write
88 packages : write
99
10+ env :
11+ VCPKG_REF : ' 2026.01.16'
12+
1013jobs :
1114 test :
1215 name : Unit Tests
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,12 +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"
43+ id : restore-test-cache
3344 uses : actions/cache/restore@v4
3445 with :
3546 path : ${{ github.workspace }}/vcpkg-test-cache
36- key : vcpkg-test-cache-${{ github.run_id }}
37- 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 }}
3849
3950 - name : CMake Build
4051 run : |
@@ -44,10 +55,11 @@ jobs:
4455 make test
4556
4657 - name : " Save VCPKG cache"
58+ if : steps.restore-test-cache.outputs.cache-hit != 'true'
4759 uses : actions/cache/save@v4
4860 with :
4961 path : ${{ github.workspace }}/vcpkg-test-cache
50- key : vcpkg-test-cache-${{ github.run_id }}
62+ key : vcpkg-test-cache-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}
5163
5264 build :
5365 needs : test
6678 with :
6779 repository : microsoft/vcpkg
6880 path : vcpkg
69- ref : ' 2026.01.16 '
81+ ref : ${{ env.VCPKG_REF }}
7082
7183 - name : Checkout code
7284 uses : actions/checkout@v6
@@ -75,12 +87,20 @@ jobs:
7587 path : WebFrame
7688 ref : ${{ github.ref }}
7789
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+
7897 - name : " Restore VCPKG cache"
98+ id : restore-build-cache
7999 uses : actions/cache/restore@v5
80100 with :
81101 path : ${{ github.workspace }}/vcpkg-${{ matrix.os }}
82- key : vcpkg-${{ matrix.os }}-${{ github.run_id }}
83- 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 }}
84104
85105 - name : Ubuntu setup
86106 if : matrix.os == 'ubuntu-latest'
96116 cmake --build build
97117
98118 - name : " Save VCPKG cache"
119+ if : steps.restore-build-cache.outputs.cache-hit != 'true'
99120 uses : actions/cache/save@v5
100121 with :
101122 path : ${{ github.workspace }}/vcpkg-${{ matrix.os }}
102- key : vcpkg-${{ matrix.os }}-${{ github.run_id }}
123+ key : vcpkg-${{ matrix.os }}-${{ env.VCPKG_REF }}-${{ steps.vcpkg-hash.outputs.value }}
0 commit comments