@@ -44,21 +44,13 @@ jobs:
4444 with :
4545 compiler : ${{ matrix.compiler }}
4646
47- # BuildCache cache
48- - name : Cache BuildCache directory
49- uses : actions/cache@v4
50- with :
51- path : .buildcache
52- key : buildcache-linux-${{ matrix.compiler }}
53- restore-keys : |
54- buildcache-linux-${{ matrix.compiler }}-
5547
5648 # Vcpkg cache
57- - name : Cache vcpkg installed
58- uses : actions/cache@v4
49+ - name : Restore vcpkg cache
50+ id : restore-vcpkg
51+ uses : actions/cache/restore@v4
5952 with :
60- path : |
61- vcpkg_installed
53+ path : vcpkg_installed
6254 key : vcpkg-installed-linux-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }}
6355 restore-keys : |
6456 vcpkg-installed-linux-${{ matrix.compiler }}-
@@ -69,12 +61,34 @@ jobs:
6961 run : |
7062 cp ci/CMakeUserPresets.json CMakeUserPresets.json
7163 cmake --preset ci_${{ matrix.compiler }}_af_cpu
64+
65+ - name : Save vcpkg cache
66+ if : steps.restore-vcpkg.cache-hit != 'true'
67+ uses : actions/cache/save@v4
68+ with :
69+ path : vcpkg_installed
70+ key : ${{ steps.restore-vcpkg.outputs.cache-primary-key }}
71+
72+ - name : Restore BuildCache cache
73+ id : restore-buildcache
74+ uses : actions/cache/restore@v4
75+ with :
76+ path : .buildcache
77+ key : buildcache-linux-${{ matrix.compiler }}-${{ github.run_id }}
78+ restore-keys : |
79+ buildcache-linux-${{ matrix.compiler }}-
7280
7381 - name : Build
7482 uses : ./.github/actions/run-linux
7583 with :
7684 run : cmake --build --preset linux_${{ matrix.compiler }}_af_cpu_ci_build_test
7785
86+ - name : Save BuildCache cache
87+ uses : actions/cache/save@v4
88+ with :
89+ path : .buildcache
90+ key : ${{ steps.restore-buildcache.outputs.cache-primary-key }}
91+
7892 - name : Test
7993 uses : ./.github/actions/run-linux
8094 with :
@@ -125,24 +139,39 @@ jobs:
125139 with :
126140 compiler : ${{ matrix.compiler }}
127141
142+ # Vcpkg cache
143+ - name : Restore vcpkg cache
144+ id : restore-vcpkg-win
145+ uses : actions/cache/restore@v4
146+ with :
147+ path : vcpkg_installed
148+ key : vcpkg-installed-windows-${{ matrix.compiler }}-${{ hashFiles('vcpkg-configuration.json') }}
149+ restore-keys : |
150+ vcpkg-installed-windows-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }}
151+ vcpkg-installed-windows-${{ matrix.compiler }}-
152+
153+ - name : Save vcpkg cache
154+ if : steps.restore-vcpkg-win.cache-hit != 'true'
155+ uses : actions/cache/save@v4
156+ with :
157+ path : vcpkg_installed
158+ key : ${{ steps.restore-vcpkg-win.outputs.cache-primary-key }}
159+
128160 # BuildCache cache
129- - name : Cache BuildCache directory
130- uses : actions/cache@v4
161+ - name : Restore BuildCache cache
162+ id : restore-buildcache-win
163+ uses : actions/cache/restore@v4
131164 with :
132165 path : .buildcache
133- key : buildcache-windows-${{ matrix.compiler }}
166+ key : buildcache-windows-${{ matrix.compiler }}-${{ github.run_id }}
134167 restore-keys : |
135168 buildcache-windows-${{ matrix.compiler }}-
136169
137- # Vcpkg cache
138- - name : Cache vcpkg installed
139- uses : actions/cache@v4
170+ - name : Save BuildCache cache
171+ uses : actions/cache/save@v4
140172 with :
141- path : |
142- vcpkg_installed
143- key : vcpkg-installed-windows-${{ matrix.compiler }}-${{ hashFiles('vcpkg.json') }}
144- restore-keys : |
145- vcpkg-installed-windows-${{ matrix.compiler }}-
173+ path : .buildcache
174+ key : ${{ steps.restore-buildcache-win.outputs.cache-primary-key }}
146175
147176 - name : Configure
148177 shell : pwsh
0 commit comments