Skip to content

Commit 14ae194

Browse files
committed
fix windows
1 parent 92dd71f commit 14ae194

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,11 @@ jobs:
238238
path: |
239239
${{ runner.tool_cache }}/opam
240240
~/.opam
241+
~/cygwin
241242
_opam
242243
.opam-path
243244
.opam-env
244-
key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }}
245+
key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }}
245246

246247
- name: Use OCaml ${{matrix.ocaml_compiler}}
247248
uses: ocaml/setup-ocaml@v2
@@ -266,13 +267,8 @@ jobs:
266267
- name: Get OPAM environment
267268
if: steps.cache-opam-env.outputs.cache-hit != 'true'
268269
run: |
269-
if [[ "$RUNNER_OS" == "Windows" ]]; then
270-
which opam.exe > .opam-path
271-
else
272-
which opam > .opam-path
273-
fi
270+
command -v opam | tee .opam-path
274271
opam env > .opam-env
275-
shell: bash
276272
277273
- name: Install OPAM dependencies
278274
if: steps.cache-opam-env.outputs.cache-hit != 'true'
@@ -285,17 +281,35 @@ jobs:
285281
path: |
286282
${{ runner.tool_cache }}/opam
287283
~/.opam
284+
~/cygwin
288285
_opam
289286
.opam-path
290287
.opam-env
291-
key: opam-env-v3-${{ matrix.os }}-${{ hashFiles('dune-project') }}
288+
key: opam-env-v5-${{ matrix.os }}-${{ hashFiles('dune-project') }}
292289

293290
- name: Use cached OPAM environment
294291
if: steps.cache-opam-env.outputs.cache-hit == 'true'
295292
run: |
296-
OPAM_PATH="$(cat .opam-path)"
297-
chmod +x "$OPAM_PATH"
298-
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
293+
if [[ "$RUNNER_OS" != "Windows" ]]; then
294+
OPAM_PATH="$(cat .opam-path)"
295+
chmod +x "$OPAM_PATH"
296+
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
297+
298+
else
299+
CYGWIN="winsymlinks:native"
300+
CYGWIN_ROOT="D:\\cygwin"
301+
CYGWIN_ROOT_BIN="D:\\cygwin\\bin"
302+
CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin"
303+
304+
echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV"
305+
echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV"
306+
echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV"
307+
echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV"
308+
309+
echo "$CYGWIN_ROOT_BIN" >> "$GITHUB_PATH"
310+
echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH"
311+
fi
312+
299313
sed "s/'//g; s/; export .*//g" .opam-env >> "$GITHUB_ENV"
300314
shell: bash
301315

0 commit comments

Comments
 (0)