9191 sudo chmod +x /usr/bin/sccache
9292 shell : bash
9393
94- - name : Cache scoop (on Windows)
95- uses : actions/cache@v3
94+ - name : Cache scoop (restore) (on Windows)
95+ uses : actions/cache/restore@v3
96+ id : restore-scoop-cache
9697 if : runner.os == 'Windows'
9798 with :
9899 path : ~\scoop
@@ -101,33 +102,18 @@ jobs:
101102 ${{ runner.os }}-scoop-${{ env.OS_VER }}-
102103 ${{ runner.os }}-scoop-
103104
104- - name : Cache vcpkg/downloads (on Windows)
105- uses : actions/cache@v3
105+ - name : Cache vcpkg/downloads and vcpkg/installed (restore) (on Windows)
106+ uses : actions/cache/restore@v3
107+ id : restore-vcpkg-cache
106108 if : runner.os == 'Windows'
107109 with :
108- path : C:\vcpkg\downloads
109- key : ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }}
110+ path : |
111+ C:\vcpkg\downloads
112+ C:\vcpkg\installed
113+ key : ${{ runner.os }}-vcpkg-${{ env.OS_VER }}-${{ hashFiles('.github/workflows/build.yml') }}
110114 restore-keys : |
111- ${{ runner.os }}-vcpkg-download-${{ env.OS_VER }}-
112- ${{ runner.os }}-vcpkg-download-
113- - name : Cache vcpkg/installed (on Windows)
114- uses : actions/cache@v3
115- if : runner.os == 'Windows'
116- with :
117- path : C:\vcpkg\installed
118- key : ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-${{ hashFiles('.github/workflows/build.yml') }}
119- restore-keys : |
120- ${{ runner.os }}-vcpkg-installed-${{ matrix.os }}-
121- ${{ runner.os }}-vcpkg-installed-
122-
123- - name : Cache SCCACHE_DIR
124- uses : actions/cache@v3
125- with :
126- path : " ${{ env.SCCACHE_DIR }}"
127- key : ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }}
128- restore-keys : |
129- ${{ runner.os }}-sccache-${{ matrix.os }}-
130- ${{ runner.os }}-sccache-
115+ ${{ runner.os }}-vcpkg-${{ env.OS_VER }}-
116+ ${{ runner.os }}-vcpkg-
131117
132118 - name : Install Windows dependencies
133119 if : runner.os == 'Windows'
@@ -141,13 +127,35 @@ jobs:
141127
142128 # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#add-a-system-path-add-path
143129 Add-Content ${env:GITHUB_PATH} "${HOME}/scoop/shims"
144-
130+ shell : pwsh
131+
132+ - name : Cache scoop (save) (on Windows)
133+ uses : actions/cache/save@v3
134+ if : runner.os == 'Windows'
135+ with :
136+ path : ~\scoop
137+ key : ${{ steps.restore-scoop-cache.outputs.cache-primary-key }}
138+
139+ - name : Cache vcpkg/downloads and vcpkg/installed (save) (on Windows)
140+ uses : actions/cache/save@v3
141+ if : runner.os == 'Windows'
142+ with :
143+ path : |
144+ C:\vcpkg\downloads
145+ C:\vcpkg\installed
146+ key : ${{ steps.restore-vcpkg-cache.outputs.cache-primary-key }}
147+
148+ # don't save this into the vcpkg cache
149+ - name : Copy over Boost DLLs to where we expect them
150+ if : runner.os == 'Windows'
151+ run : |
145152 # work around assumptions in our build scripts about boost libs layout
146153 Copy-Item -Path C:/vcpkg/installed/x64-windows/debug/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/debug/lib
147154 Get-Item C:/vcpkg/installed/x64-windows/debug/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-gd-x64-1_81.dll','-vc140-mt-gd.dll' }
148155 # display results of this hard work
149156 ls C:/vcpkg/installed/x64-windows/debug/bin/
150157 ls C:/vcpkg/installed/x64-windows/debug/lib/
158+
151159 # now do the same for release
152160 Copy-Item -Path C:/vcpkg/installed/x64-windows/bin/* -Include *.dll -Destination C:/vcpkg/installed/x64-windows/lib
153161 Get-Item C:/vcpkg/installed/x64-windows/lib/*.dll | Rename-Item -NewName { $_.Name -replace '-vc14.-mt-x64-1_81.dll','-vc140-mt.dll' }
@@ -156,6 +164,16 @@ jobs:
156164 ls C:/vcpkg/installed/x64-windows/lib/
157165 shell : pwsh
158166
167+ - name : Cache SCCACHE_DIR (restore)
168+ uses : actions/cache/restore@v3
169+ id : restore-sccache-cache
170+ with :
171+ path : " ${{ env.SCCACHE_DIR }}"
172+ key : ${{ runner.os }}-sccache-${{ matrix.os }}-${{ github.sha }}
173+ restore-keys : |
174+ ${{ runner.os }}-sccache-${{ matrix.os }}-
175+ ${{ runner.os }}-sccache-
176+
159177 # Windows build should ideally use something like '-G "Visual Studio 16 2019" -A x64',
160178 # but -DCMAKE_C_COMPILER_LAUNCHER is only supported by make and ninja generators
161179 # https://devblogs.microsoft.com/scripting/powertip-line-continuation-in-powershell/
@@ -176,6 +194,12 @@ jobs:
176194 cmake --install "${{env.BuildDir}}" --config ${{env.BuildType}}
177195 shell : pwsh
178196
197+ - name : Cache SCCACHE_DIR (save)
198+ uses : actions/cache/save@v3
199+ with :
200+ path : " ${{ env.SCCACHE_DIR }}"
201+ key : ${{ steps.restore-sccache-cache.outputs.cache-primary-key }}
202+
179203 - id : ctest
180204 name : ctest
181205 working-directory : ${{env.BuildDir}}
0 commit comments