Skip to content

Commit d81347c

Browse files
committed
almost there?
1 parent d28da22 commit d81347c

File tree

1 file changed

+33
-28
lines changed

1 file changed

+33
-28
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -213,26 +213,26 @@ jobs:
213213
chmod +x rewatch/rewatch
214214
chmod +x _build/install/default/bin/*
215215
216-
- name: Restore OPAM env
217-
id: cache-opam-env
216+
- name: Restore OPAM tool
217+
id: cache-opam-tool
218218
uses: actions/cache/restore@v4
219219
with:
220220
path: |
221221
${{ runner.tool_cache }}/opam
222222
~/.opam
223-
key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }}
223+
key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }}
224224

225225
- name: Use OCaml ${{matrix.ocaml_compiler}}
226226
uses: ocaml/setup-ocaml@v2
227-
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
227+
if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
228228
with:
229229
ocaml-compiler: ${{matrix.ocaml_compiler}}
230230
opam-pin: false
231231
opam-depext: false
232232

233233
- name: Use OCaml ${{matrix.ocaml_compiler}} (Win)
234234
uses: ocaml/setup-ocaml@v2
235-
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
235+
if: steps.cache-opam-tool.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
236236
with:
237237
ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw
238238
opam-pin: false
@@ -243,50 +243,55 @@ jobs:
243243
default: https://github.com/ocaml/opam-repository.git
244244
245245
- name: Install OPAM dependencies
246-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
246+
if: steps.cache-opam-tool.outputs.cache-hit != 'true'
247247
run: opam install . --deps-only
248248

249-
- name: Cache OPAM env
250-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
249+
- name: Save OPAM tool
250+
if: steps.cache-opam-tool.outputs.cache-hit != 'true'
251251
uses: actions/cache/save@v4
252252
with:
253253
path: |
254254
${{ runner.tool_cache }}/opam
255255
~/.opam
256-
key: opam-env-v1-${{ runner.os }}-${{ hashFiles('dune-project') }}
256+
key: opam-tool-v1-${{ matrix.os }}-${{ hashFiles('dune-project') }}
257257

258-
- name: Get OPAM path
259-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
258+
- name: Get OPAM env
259+
if: steps.cache-opam-tool.outputs.cache-hit != 'true'
260260
run: |
261-
which opam
262261
which opam > .opam-path
262+
opam env > .opam-env
263263
264-
- name: Cache OPAM path
265-
id: cache-opam-path
266-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
264+
- name: Save OPAM env
265+
id: cache-opam-env
266+
if: steps.cache-opam-tool.outputs.cache-hit != 'true'
267267
uses: actions/cache/save@v4
268268
with:
269-
path: .opam-path
270-
key: opam-path-${{ runner.os }}
269+
path: |
270+
.opam-path
271+
.opam-env
272+
key: opam-path-${{ matrix.os }}
271273

272-
- name: Restore OPAM path
273-
if: steps.cache-opam-env.outputs.cache-hit == 'true'
274+
- name: Restore OPAM env
275+
if: steps.cache-opam-tool.outputs.cache-hit == 'true'
274276
uses: actions/cache/restore@v4
275277
with:
276-
path: .opam-path
277-
key: opam-path-${{ runner.os }}
278+
path: |
279+
.opam-path
280+
.opam-env
281+
key: opam-path-${{ matrix.os }}
278282

279-
- name: Use cached OPAM env
280-
if: steps.cache-opam-env.outputs.cache-hit == 'true'
283+
- name: Use cached OPAM env - $PATH
284+
if: steps.cache-opam-tool.outputs.cache-hit == 'true'
281285
run: |
282286
OPAM_PATH="$(cat .opam-path)"
283-
chmod +x $OPAM_PATH
284-
dirname $OPAM_PATH >> $GITHUB_PATH
287+
chmod +x "$OPAM_PATH"
288+
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
285289
286-
- name: Use cached OPAM env
287-
if: steps.cache-opam-env.outputs.cache-hit == 'true'
290+
- name: Use cached OPAM env - Environment variables
291+
if: steps.cache-opam-tool.outputs.cache-hit == 'true'
288292
run: |
289-
opam env | sed "s/'//g; s/; export .*//g" >> $GITHUB_ENV
293+
OPAM_ENV="$(cat .opam-env)"
294+
sed "s/'//g; s/; export .*//g" "$OPAM_ENV" >> "$GITHUB_ENV"
290295
291296
- name: "Build compiler"
292297
if: runner.os != 'Linux'

0 commit comments

Comments
 (0)