Skip to content

Commit fe999c4

Browse files
committed
fix
1 parent 0430542 commit fe999c4

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,9 @@ jobs:
245245
~/.opam
246246
_opam
247247
.opam-path
248-
.opam-env
249248
D:\cygwin
250249
D:\.opam
251-
key: opam-env-v10-${{ matrix.os }}-${{ hashFiles('dune-project') }}
250+
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
252251

253252
- name: Use OCaml ${{matrix.ocaml_compiler}}
254253
uses: ocaml/setup-ocaml@v3.0.0
@@ -257,12 +256,20 @@ jobs:
257256
ocaml-compiler: ${{matrix.ocaml_compiler}}
258257
opam-pin: false
259258

260-
- name: Get OPAM environment
259+
- name: Get OPAM executable path
261260
if: steps.cache-opam-env.outputs.cache-hit != 'true'
262-
shell: bash
263-
run: |
264-
which opam | tee .opam-path
265-
opam env > .opam-env
261+
uses: actions/github-script@v7
262+
with:
263+
result-encoding: string
264+
script: |
265+
const opamPath = await io.which('opam', true);
266+
console.log('opam executable found: %s', opamPath);
267+
268+
const fs = require('fs/promises');
269+
await fs.writeFile('.opam-path', opamPath, 'utf-8');
270+
console.log('stored path to .opam-path');
271+
272+
return opamPath;
266273
267274
- name: Install OPAM dependencies
268275
if: steps.cache-opam-env.outputs.cache-hit != 'true'
@@ -277,10 +284,9 @@ jobs:
277284
~/.opam
278285
_opam
279286
.opam-path
280-
.opam-env
281287
D:\cygwin
282288
D:\.opam
283-
key: opam-env-v10-${{ matrix.os }}-${{ hashFiles('dune-project') }}
289+
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
284290

285291
- name: Use cached OPAM environment
286292
if: steps.cache-opam-env.outputs.cache-hit == 'true'
@@ -296,7 +302,7 @@ jobs:
296302
if [[ "$RUNNER_OS" != "Windows" ]]; then
297303
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV"
298304
else
299-
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
305+
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
300306
fi
301307
302308
OPAM_PATH="$(cat .opam-path)"

0 commit comments

Comments
 (0)