@@ -231,27 +231,29 @@ jobs:
231
231
packages : bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
232
232
version : v1
233
233
234
- - name : Restore OPAM tool
235
- id : cache-opam-tool
234
+ - name : Restore OPAM environment
235
+ id : cache-opam-env
236
236
uses : actions/cache/restore@v4
237
237
with :
238
238
path : |
239
239
${{ runner.tool_cache }}/opam
240
240
~/.opam
241
241
_opam
242
- key : opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }}
242
+ .opam-path
243
+ .opam-env
244
+ key : opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }}
243
245
244
246
- name : Use OCaml ${{matrix.ocaml_compiler}}
245
247
uses : ocaml/setup-ocaml@v2
246
- if : steps.cache-opam-tool .outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
248
+ if : steps.cache-opam-env .outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
247
249
with :
248
250
ocaml-compiler : ${{matrix.ocaml_compiler}}
249
251
opam-pin : false
250
252
opam-depext : false
251
253
252
254
- name : Use OCaml ${{matrix.ocaml_compiler}} (Win)
253
255
uses : ocaml/setup-ocaml@v2
254
- if : steps.cache-opam-tool .outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
256
+ if : steps.cache-opam-env .outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
255
257
with :
256
258
ocaml-compiler : ocaml-variants.5.2.0+options,ocaml-option-mingw
257
259
opam-pin : false
@@ -261,22 +263,8 @@ jobs:
261
263
sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
262
264
default: https://github.com/ocaml/opam-repository.git
263
265
264
- - name : Install OPAM dependencies
265
- if : steps.cache-opam-tool.outputs.cache-hit != 'true'
266
- run : opam install . --deps-only
267
-
268
- - name : Save OPAM tool
269
- if : steps.cache-opam-tool.outputs.cache-hit != 'true'
270
- uses : actions/cache/save@v4
271
- with :
272
- path : |
273
- ${{ runner.tool_cache }}/opam
274
- ~/.opam
275
- _opam
276
- key : opam-tool-v2-${{ matrix.os }}-${{ hashFiles('dune-project') }}
277
-
278
- - name : Get OPAM env
279
- if : steps.cache-opam-tool.outputs.cache-hit != 'true'
266
+ - name : Get OPAM environment
267
+ if : steps.cache-opam-env.outputs.cache-hit != 'true'
280
268
run : |
281
269
if [[ "$RUNNER_OS" == "Windows" ]]; then
282
270
which opam.exe > .opam-path
@@ -286,40 +274,32 @@ jobs:
286
274
opam env > .opam-env
287
275
shell : bash
288
276
289
- - name : Save OPAM env
290
- id : cache-opam-env
291
- if : steps.cache-opam-tool.outputs.cache-hit != 'true'
292
- uses : actions/cache/save@v4
293
- with :
294
- path : |
295
- .opam-path
296
- .opam-env
297
- key : opam-env-v2-${{ matrix.os }}
277
+ - name : Install OPAM dependencies
278
+ if : steps.cache-opam-env.outputs.cache-hit != 'true'
279
+ run : opam install . --deps-only
298
280
299
- - name : Restore OPAM env
300
- if : steps.cache-opam-tool .outputs.cache-hit = = 'true'
301
- uses : actions/cache/restore @v4
281
+ - name : Cache OPAM environment
282
+ if : steps.cache-opam-env .outputs.cache-hit ! = 'true'
283
+ uses : actions/cache/save @v4
302
284
with :
303
285
path : |
286
+ ${{ runner.tool_cache }}/opam
287
+ ~/.opam
288
+ _opam
304
289
.opam-path
305
290
.opam-env
306
- key : opam-env-v2 -${{ matrix.os }}
291
+ key : opam-env-v3 -${{ matrix.os }}-${{ hashFiles('dune-project') }}
307
292
308
- - name : Use cached OPAM env - $PATH
309
- if : steps.cache-opam-tool .outputs.cache-hit == 'true'
293
+ - name : Use cached OPAM environment
294
+ if : steps.cache-opam-env .outputs.cache-hit == 'true'
310
295
run : |
311
296
OPAM_PATH="$(cat .opam-path)"
312
297
chmod +x "$OPAM_PATH"
313
298
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
314
- shell : bash
315
-
316
- - name : Use cached OPAM env - Environment variables
317
- if : steps.cache-opam-tool.outputs.cache-hit == 'true'
318
- run : |
319
299
sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV"
320
300
shell : bash
321
301
322
- - name : " Build compiler"
302
+ - name : Build compiler
323
303
if : runner.os != 'Linux'
324
304
run : opam exec -- dune build --display quiet --profile release
325
305
0 commit comments