Skip to content

Commit df7d293

Browse files
committed
ci(vs-build): cache the vcpkg artifacts
The vcpkg artifacts are rebuilt only once per week, therefore it makes sense to cache them closer to where the GitHub workflow runs. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 03432b9 commit df7d293

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,26 @@ jobs:
136136
steps:
137137
- uses: actions/checkout@v2
138138
- uses: git-for-windows/setup-git-for-windows-sdk@main
139-
- name: download vcpkg artifacts
139+
- name: Determine the latest vcpkg build ID
140+
id: vcpkg-build-id
140141
shell: bash
141142
run: |
142143
urlbase=https://dev.azure.com/git/git/_apis/build/builds
143144
id=$(curl "$urlbase?definitions=9&statusFilter=completed&resultFilter=succeeded&\$top=1" |
144145
jq -r '.value[0].id')
146+
echo "::set-output name=id::$id"
147+
- name: Cache vcpkg
148+
id: cache-vcpkg
149+
uses: actions/cache@v2
150+
with:
151+
path: compat/vcbuild/vcpkg
152+
key: vcpkg-artifacts-${{ steps.vcpkg-build-id.outputs.id }}
153+
- name: download vcpkg artifacts
154+
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
155+
shell: bash
156+
run: |
157+
urlbase=https://dev.azure.com/git/git/_apis/build/builds
158+
id=${{ steps.vcpkg-build-id.outputs.id }}
145159
download_url=$(curl "$urlbase/$id/artifacts" |
146160
jq -r '.value[] | select(.name == "compat").resource.downloadUrl')
147161
curl -o compat.zip "$download_url"

0 commit comments

Comments
 (0)