Skip to content

Commit 15a28f9

Browse files
committed
ci: cache installed vcpkg packages
Change caching to cache installed packages and run vcpkg upgrade to match the previous behavior where packages were re-built each time. Signed-off-by: Erik Cederberg <erik.cederberg@sectra.com>
1 parent 2c23b6f commit 15a28f9

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

.github/workflows/call-build-windows.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,16 @@ jobs:
8282
config:
8383
- name: "Windows 32bit"
8484
arch: x86
85-
openssl_dir: C:\vcpkg\packages\openssl_x86-windows-static
8685
cmake_additional_opt: ""
8786
vcpkg_triplet: x86-windows-static
8887
cmake_version: "3.31.6"
8988
- name: "Windows 64bit"
9089
arch: x64
91-
openssl_dir: C:\vcpkg\packages\openssl_x64-windows-static
9290
cmake_additional_opt: ""
9391
vcpkg_triplet: x64-windows-static
9492
cmake_version: "3.31.6"
9593
- name: "Windows 64bit (Arm64)"
9694
arch: amd64_arm64
97-
openssl_dir: C:\vcpkg\packages\openssl_arm64-windows-static
9895
cmake_additional_opt: "-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_SYSTEM_PROCESSOR=ARM64"
9996
vcpkg_triplet: arm64-windows-static
10097
cmake_version: "3.31.6"
@@ -143,10 +140,10 @@ jobs:
143140
uses: actions/cache/restore@v4
144141
with:
145142
path: |
146-
C:\vcpkg\packages
147-
key: ${{ runner.os }}-${{ matrix.config.arch }}-vcpkg-${{ steps.get-date.outputs.date }}
143+
C:\vcpkg\installed
144+
key: ${{ runner.os }}-${{ matrix.config.arch }}-vcpkg-installed-${{ steps.get-date.outputs.date }}
148145
restore-keys: |
149-
${{ runner.os }}-${{ matrix.config.arch }}-vcpkg-
146+
${{ runner.os }}-${{ matrix.config.arch }}-vcpkg-installed-
150147
enableCrossOsArchive: false
151148

152149
- name: Build openssl with vcpkg
@@ -159,12 +156,17 @@ jobs:
159156
C:\vcpkg\vcpkg install --recurse libyaml --triplet ${{ matrix.config.vcpkg_triplet }}
160157
shell: cmd
161158

159+
- name: Upgrade any outdated vcpkg packages
160+
run: |
161+
C:\vcpkg\vcpkg upgrade --no-dry-run
162+
shell: cmd
163+
162164
- name: Save packages of vcpkg
163165
id: save-vcpkg-sources
164166
uses: actions/cache/save@v4
165167
with:
166168
path: |
167-
C:\vcpkg\packages
169+
C:\vcpkg\installed
168170
key: ${{ steps.cache-vcpkg-sources.outputs.cache-primary-key }}
169171
enableCrossOsArchive: false
170172

@@ -174,7 +176,7 @@ jobs:
174176
# This is only supposed to be a workaround for now so can be easily removed later.
175177
if: ${{ matrix.config.arch != 'amd64_arm64' || needs.call-build-windows-get-meta.outputs.armSupported == 'true' }}
176178
run: |
177-
cmake -G "Ninja" -DFLB_NIGHTLY_BUILD='${{ inputs.unstable }}' -DOPENSSL_ROOT_DIR='${{ matrix.config.openssl_dir }}' ${{ matrix.config.cmake_additional_opt }} -DFLB_LIBYAML_DIR=C:\vcpkg\packages\libyaml_${{ matrix.config.vcpkg_triplet }} ../
179+
cmake -G "Ninja" -DFLB_NIGHTLY_BUILD='${{ inputs.unstable }}' -DOPENSSL_ROOT_DIR='C:\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}' ${{ matrix.config.cmake_additional_opt }} -DFLB_LIBYAML_DIR='C:\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}' ../
178180
cmake --build .
179181
cpack
180182
working-directory: build

.github/workflows/call-windows-unit-tests.yaml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ jobs:
3636
config:
3737
- name: "Windows 32bit"
3838
arch: x86
39-
openssl_dir: C:\vcpkg\packages\openssl_x86-windows-static
4039
cmake_additional_opt: ""
4140
vcpkg_triplet: x86-windows-static
4241
cmake_version: "3.31.6"
4342
- name: "Windows 64bit"
4443
arch: x64
45-
openssl_dir: C:\vcpkg\packages\openssl_x64-windows-static
4644
cmake_additional_opt: ""
4745
vcpkg_triplet: x64-windows-static
4846
cmake_version: "3.31.6"
@@ -91,10 +89,10 @@ jobs:
9189
uses: actions/cache/restore@v4
9290
with:
9391
path: |
94-
C:\vcpkg\packages
95-
key: ${{ runner.os }}-${{ matrix.config.arch }}-wintest-vcpkg-${{ steps.get-date.outputs.date }}
92+
C:\vcpkg\installed
93+
key: ${{ runner.os }}-${{ matrix.config.arch }}-wintest-vcpkg-installed-${{ steps.get-date.outputs.date }}
9694
restore-keys: |
97-
${{ runner.os }}-${{ matrix.config.arch }}-wintest-vcpkg-
95+
${{ runner.os }}-${{ matrix.config.arch }}-wintest-vcpkg-installed-
9896
enableCrossOsArchive: false
9997

10098
- name: Build openssl with vcpkg
@@ -107,12 +105,17 @@ jobs:
107105
C:\vcpkg\vcpkg install --recurse libyaml --triplet ${{ matrix.config.vcpkg_triplet }}
108106
shell: cmd
109107

108+
- name: Upgrade any outdated vcpkg packages
109+
run: |
110+
C:\vcpkg\vcpkg upgrade --no-dry-run
111+
shell: cmd
112+
110113
- name: Save packages of vcpkg
111114
id: save-vcpkg-sources
112115
uses: actions/cache/save@v4
113116
with:
114117
path: |
115-
C:\vcpkg\packages
118+
C:\vcpkg\installed
116119
key: ${{ steps.cache-unit-test-vcpkg-sources.outputs.cache-primary-key }}
117120
enableCrossOsArchive: false
118121

@@ -121,9 +124,9 @@ jobs:
121124
cmake -G "Ninja" `
122125
-D FLB_TESTS_INTERNAL=On `
123126
-D FLB_NIGHTLY_BUILD='${{ inputs.unstable }}' `
124-
-D OPENSSL_ROOT_DIR='${{ matrix.config.openssl_dir }}' `
127+
-D OPENSSL_ROOT_DIR='C:\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}' `
125128
${{ matrix.config.cmake_additional_opt }} `
126-
-D FLB_LIBYAML_DIR=C:\vcpkg\packages\libyaml_${{ matrix.config.vcpkg_triplet }} `
129+
-D FLB_LIBYAML_DIR='C:\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}' `
127130
-D FLB_WITHOUT_flb-rt-out_elasticsearch=On `
128131
-D FLB_WITHOUT_flb-rt-out_td=On `
129132
-D FLB_WITHOUT_flb-rt-out_forward=On `

0 commit comments

Comments
 (0)