Skip to content

Commit e1d8441

Browse files
committed
Use manual caching for vcpkg in ci-msvc to speed up build times
1 parent 8b6c4ba commit e1d8441

File tree

6 files changed

+111
-18
lines changed

6 files changed

+111
-18
lines changed

.github/workflows/ci-msvc.yml

Lines changed: 62 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
name: ci-msvc
77

88
on:
9+
workflow_dispatch:
910
push:
1011
paths:
1112
- "**"
@@ -75,10 +76,16 @@ env:
7576

7677
BUILD_PROJECTS_ES: exult_studio
7778

79+
VCPKGINSTALLED_PATH: ${{format('{0}/msvcstuff/vs2019/vcpkg_installed/x64-windows', github.workspace) }}
80+
81+
VCPKGINSTALLED_PATH_ES: ${{format('{0}/msvcstuff/vs2019/exult_studio/vcpkg_installed/x64-windows', github.workspace) }}
82+
7883
TARGET_VCPKG_MANIFEST_INSTALL: VcpkgInstallManifestDependencies
7984

80-
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
85+
#No automatic binary caching until microsoft fixes it
86+
VCPKG_BINARY_SOURCES: "clear"
8187

88+
8289
permissions:
8390
contents: read
8491

@@ -91,35 +98,48 @@ jobs:
9198
steps:
9299
- uses: actions/checkout@v4
93100

94-
- name: Export GitHub Actions cache environment variables
95-
uses: actions/github-script@v7
96-
with:
97-
script: |
98-
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
99-
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
100-
101101
- name: Add MSBuild to PATH
102102
uses: microsoft/setup-msbuild@v2
103103

104-
- name: Update and Integrate vcpkg
104+
- name: Setup vcpkg for Exult
105105
working-directory: ${{env.GITHUB_WORKSPACE}}
106106
run: |
107107
cd $Env:VCPKG_INSTALLATION_ROOT
108-
git fetch
109-
git merge --ff-only db1ddd0
110108
.\bootstrap-vcpkg.bat
111-
vcpkg integrate install
109+
./vcpkg integrate install
110+
'VCPKG_REV='|Out-File -Append -NoNewLine ${{ github.env }}
111+
git rev-parse HEAD|Out-File -Append ${{ github.env }}
112112
113+
- name: Restore VCPKG packages for Exult from Cache
114+
uses: actions/cache/restore@v4
115+
id: exult-vcpkg-cache-restore
116+
with:
117+
path: ${{env.VCPKGINSTALLED_PATH}}
118+
# Use the git rev hash of vcpkg in the cache key because things are not
119+
# entirely compatible between versions and when the Windows runner image
120+
# updates about every 2 weeks the version of vcpkg is updated causing
121+
# bad caching behaviour during the switch over period
122+
key: exult-vcpkg-packages-${{env.VCPKG_REV}}-${{github.sha}}
123+
restore-keys: |
124+
exult-vcpkg-packages-${{env.VCPKG_REV}}
113125
114126
- name: Install VCPKG packages for Exult
115127
working-directory: ${{env.GITHUB_WORKSPACE}}
116128
run: msbuild /v:${{ runner.debug =='1' && 'detailed' || 'normal' }} /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}}\Exult.vcxproj /t:${{env.TARGET_VCPKG_MANIFEST_INSTALL}}
117129

130+
- name: Save VCPKG packages for Exult to cache
131+
id: exult-vcpkg-cache-save
132+
uses: actions/cache/save@v4
133+
with:
134+
path: |
135+
${{env.VCPKGINSTALLED_PATH}}
136+
key: exult-vcpkg-packages-${{env.VCPKG_REV}}-${{github.sha}}
137+
118138
- name: Build Exult
119139
working-directory: ${{env.GITHUB_WORKSPACE}}
120140
run: msbuild /v:${{ runner.debug =='1' && 'detailed' || 'normal' }} /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{env.BUILD_PLATFORM}} ${{env.SOLUTION_FILE_PATH}} /t:${{env.BUILD_PROJECTS}}
121-
ci-msvc-exult_studio:
122141

142+
ci-msvc-exult_studio:
123143
runs-on: windows-2022
124144
if: ${{ github.repository_owner == 'exult' || github.repository_owner == 'wench' }}
125145

@@ -136,19 +156,44 @@ jobs:
136156
- name: Add MSBuild to PATH
137157
uses: microsoft/setup-msbuild@v2
138158

139-
- name: Update and Integrate vcpkg
159+
- name: Setup vcpkg for Studio
140160
working-directory: ${{env.GITHUB_WORKSPACE}}
141161
run: |
142162
cd $Env:VCPKG_INSTALLATION_ROOT
143-
git fetch
144-
git merge --ff-only db1ddd0
145163
.\bootstrap-vcpkg.bat
146-
vcpkg integrate install
164+
./vcpkg integrate install
165+
'VCPKG_REV='|Out-File -Append -NoNewLine ${{ github.env }}
166+
git rev-parse HEAD|Out-File -Append ${{ github.env }}
167+
168+
- name: Restore VCPKG packages for Studio from Cache
169+
uses: actions/cache/restore@v4
170+
id: studio-vcpkg-cache-restore
171+
with:
172+
path: ${{env.VCPKGINSTALLED_PATH_ES}}
173+
key: studio-vcpkg-packages-${{env.VCPKG_REV}}-${{github.sha}}
174+
restore-keys: |
175+
studio-vcpkg-packages-${{env.VCPKG_REV}}
147176
148177
- name: Install VCPKG packages for Studio
149178
working-directory: ${{env.GITHUB_WORKSPACE}}
150179
run: msbuild /v:${{ runner.debug =='1' && 'detailed' || 'normal' }} /m /p:Configuration=${{env.BUILD_CONFIGURATION_ES}} /p:Platform=${{env.BUILD_PLATFORM_ES}} ${{env.SOLUTION_FILE_PATH}}\exult_studio\exult_studio.vcxproj /t:${{env.TARGET_VCPKG_MANIFEST_INSTALL}}
151180

181+
- name: Save Studio VCPKG packages to cache
182+
id: studio-vcpkg-cache-save
183+
uses: actions/cache/save@v4
184+
with:
185+
path: |
186+
${{env.VCPKGINSTALLED_PATH_ES}}
187+
key: studio-vcpkg-packages-${{env.VCPKG_REV}}-${{github.sha}}
188+
189+
- name: Restore VCPKG packages for Exult from Cache
190+
uses: actions/cache/restore@v4
191+
id: exult-vcpkg-cache-restore
192+
with:
193+
path: ${{env.VCPKGINSTALLED_PATH}}
194+
key: exult-vcpkg-packages-${{env.VCPKG_REV}}-${{github.sha}}
195+
restore-keys: |
196+
exult-vcpkg-packages-${{env.VCPKG_REV}}
152197
- name: Build exult_studio
153198
working-directory: ${{env.GITHUB_WORKSPACE}}
154199
run: msbuild /v:${{ runner.debug =='1' && 'detailed' || 'normal' }} /m /p:Configuration=${{env.BUILD_CONFIGURATION_ES}} /p:Platform=${{env.BUILD_PLATFORM_ES}} ${{env.SOLUTION_FILE_PATH}} /t:${{env.BUILD_PROJECTS_ES}}

msvcstuff/vs2019/Exult.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,24 @@
115115
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
116116
<VcpkgUseMD>true</VcpkgUseMD>
117117
<VcpkgTriplet>x64-windows</VcpkgTriplet>
118+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
119+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
118120
</PropertyGroup>
119121
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
120122
<VcpkgUseMD>true</VcpkgUseMD>
121123
<VcpkgTriplet>x64-windows</VcpkgTriplet>
124+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
125+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
122126
</PropertyGroup>
123127
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
124128
<VcpkgTriplet>x86-windows</VcpkgTriplet>
125129
<VcpkgUseMD>true</VcpkgUseMD>
130+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
126131
</PropertyGroup>
127132
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
128133
<VcpkgTriplet>x86-windows</VcpkgTriplet>
129134
<VcpkgUseMD>true</VcpkgUseMD>
135+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
130136
</PropertyGroup>
131137
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
132138
<ClCompile>

msvcstuff/vs2019/exconfig/exconfig.vcxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@
6161
<VcpkgEnabled>true</VcpkgEnabled>
6262
<VcpkgEnableManifest>true</VcpkgEnableManifest>
6363
</PropertyGroup>
64+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
65+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
66+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
67+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
68+
</PropertyGroup>
69+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
70+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
71+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
72+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
73+
</PropertyGroup>
6474
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
6575
<ClCompile>
6676
<WarningLevel>Level3</WarningLevel>

msvcstuff/vs2019/expack/expack.vcxproj

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,26 @@
9898
<VcpkgEnabled>true</VcpkgEnabled>
9999
<VcpkgEnableManifest>true</VcpkgEnableManifest>
100100
</PropertyGroup>
101+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
102+
<VcpkgTriplet>x64-windows</VcpkgTriplet>
103+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
104+
<VcpkgAdditionalInstallOptions> --x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
105+
</PropertyGroup>
106+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
107+
<VcpkgTriplet>x64-windows</VcpkgTriplet>
108+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
109+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
110+
</PropertyGroup>
111+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
112+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
113+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
114+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
115+
</PropertyGroup>
116+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
117+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
118+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
119+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
120+
</PropertyGroup>
101121
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
102122
<ClCompile>
103123
<WarningLevel>Level3</WarningLevel>

msvcstuff/vs2019/exult_studio/exult_studio.vcxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,27 @@
9191
</PropertyGroup>
9292
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
9393
<VcpkgUseMD>true</VcpkgUseMD>
94+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
95+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
96+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
9497
</PropertyGroup>
9598
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
9699
<VcpkgUseMD>true</VcpkgUseMD>
100+
<VcpkgTriplet>x86-windows</VcpkgTriplet>
101+
<VcpkgHostTriplet>x86-windows</VcpkgHostTriplet>
102+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
97103
</PropertyGroup>
98104
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
99105
<VcpkgUseMD>true</VcpkgUseMD>
106+
<VcpkgTriplet>x64-windows</VcpkgTriplet>
107+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
108+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
100109
</PropertyGroup>
101110
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
102111
<VcpkgUseMD>true</VcpkgUseMD>
112+
<VcpkgTriplet>x64-windows</VcpkgTriplet>
113+
<VcpkgHostTriplet>x64-windows</VcpkgHostTriplet>
114+
<VcpkgAdditionalInstallOptions>--x-abi-tools-use-exact-versions</VcpkgAdditionalInstallOptions>
103115
</PropertyGroup>
104116
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
105117
<ClCompile>

msvcstuff/vs2019/vcpkg-configuration.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"default-registry": {
33
"kind": "git",
4-
"baseline": "db1ddd074bd51bf01baf4c4672b82de9680835ca",
4+
"baseline": "856505bb767458c99d8e3c3ed441f59a058d3687",
55
"repository": "https://github.com/microsoft/vcpkg"
66
},
77
"registries": [

0 commit comments

Comments
 (0)