Skip to content

Commit 6c89100

Browse files
committed
improve cache mechanism
1 parent 6728879 commit 6c89100

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

.github/workflows/ci-pr-validation.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,11 @@ jobs:
9292

9393
- name: Restore vcpkg installed cache
9494
uses: actions/cache@v4
95+
id: vcpkg-cache
96+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
9597
with:
9698
path: build/vcpkg_installed
97-
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
99+
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
98100
restore-keys: vcpkg-${{ runner.os }}-
99101

100102
- name: Build the project
@@ -126,11 +128,13 @@ jobs:
126128

127129
- name: Restore vcpkg installed cache
128130
uses: actions/cache@v4
131+
id: vcpkg-cache
132+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
129133
with:
130134
path: |
131135
build/vcpkg_installed
132136
build-boost-asio/vcpkg_installed
133-
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
137+
key: vcpkg-${{ runner.os }}-${{ hashFiles('vcpkg.json') }}
134138
restore-keys: vcpkg-${{ runner.os }}-
135139

136140
- name: Build core libraries
@@ -168,11 +172,6 @@ jobs:
168172
cmake -B build -DINTEGRATE_VCPKG=ON -DBUILD_TESTS=ON -DBUILD_PERF_TOOLS=ON
169173
cmake --build build -j8
170174
171-
- name: Verify custom vcpkg installation
172-
run: |
173-
mv vcpkg /tmp/vcpkg-custom
174-
cmake -B build-2 -DINTEGRATE_VCPKG=ON -DCMAKE_TOOLCHAIN_FILE="/tmp/vcpkg-custom/scripts/buildsystems/vcpkg.cmake"
175-
176175
cpp20-build:
177176
name: Build with the C++20 standard
178177
needs: lint
@@ -229,7 +228,7 @@ jobs:
229228
- name: Restore vcpkg and its artifacts.
230229
uses: actions/cache@v4
231230
id: vcpkg-cache
232-
continue-on-error: true
231+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
233232
with:
234233
path: |
235234
${{ github.workspace }}/vcpkg_installed
@@ -238,7 +237,6 @@ jobs:
238237
key: ${{ runner.os }}-${{ matrix.triplet }}-vcpkg-${{ hashFiles('vcpkg.json') }}
239238
restore-keys: |
240239
${{ runner.os }}-${{ matrix.triplet }}-vcpkg-
241-
save-always: true
242240
243241
- name: Get vcpkg(windows)
244242
if: ${{ runner.os == 'Windows' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
@@ -387,9 +385,11 @@ jobs:
387385

388386
- name: Restore vcpkg installed cache
389387
uses: actions/cache@v4
388+
id: vcpkg-cache
389+
if: always() && steps.vcpkg-cache.outputs.cache-hit != 'true'
390390
with:
391391
path: build-osx/vcpkg_installed
392-
key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json', 'CMakeLists.txt', 'vcpkg-triplets/**') }}
392+
key: vcpkg-${{ runner.os }}-arm64-${{ hashFiles('vcpkg.json') }}
393393
restore-keys: vcpkg-${{ runner.os }}-arm64-
394394

395395
- name: Build libraries

0 commit comments

Comments
 (0)