Skip to content

Commit 99470c6

Browse files
cknittcometkim
andauthored
setup-ocaml 3.0.0 / opam 2.2.0 (#6819)
* setup-ocaml 3.0.0 * fix * which opam * opam 2.2.0 final is out * fix windows * no audit & no scripts for installationTest --------- Co-authored-by: Hyeseong Kim <hey@hyeseong.kim>
1 parent 6cc5898 commit 99470c6

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ jobs:
187187
runs-on: ${{matrix.os}}
188188

189189
env:
190+
# setup-ocaml opam version cannot be configured
191+
# we do track its version mannually
192+
OPAM_VERSION: 2.2.0
190193
DUNE_PROFILE: release
191194

192195
steps:
@@ -245,36 +248,28 @@ jobs:
245248
~/.opam
246249
_opam
247250
.opam-path
248-
.opam-env
249251
D:\cygwin
250252
D:\.opam
251-
key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }}
253+
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
252254

253255
- name: Use OCaml ${{matrix.ocaml_compiler}}
254-
uses: ocaml/setup-ocaml@v2
255-
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os != 'windows-latest'
256+
uses: ocaml/setup-ocaml@v3.0.0
257+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
256258
with:
257259
ocaml-compiler: ${{matrix.ocaml_compiler}}
258260
opam-pin: false
259-
opam-depext: false
260261

261-
- name: Use OCaml ${{matrix.ocaml_compiler}} (Windows)
262-
uses: ocaml/setup-ocaml@v2
263-
if: steps.cache-opam-env.outputs.cache-hit != 'true' && matrix.os == 'windows-latest'
262+
- name: Get OPAM executable path
263+
if: steps.cache-opam-env.outputs.cache-hit != 'true'
264+
uses: actions/github-script@v7
264265
with:
265-
ocaml-compiler: ocaml-variants.5.2.0+options,ocaml-option-mingw
266-
opam-pin: false
267-
opam-depext: false
268-
opam-repositories: |
269-
windows-5.0: https://github.com/dra27/opam-repository.git#windows-5.0
270-
sunset: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
271-
default: https://github.com/ocaml/opam-repository.git
266+
script: |
267+
const opamPath = await io.which('opam', true);
268+
console.log('opam executable found: %s', opamPath);
272269
273-
- name: Get OPAM environment
274-
if: steps.cache-opam-env.outputs.cache-hit != 'true'
275-
run: |
276-
command -v opam | tee .opam-path
277-
opam env > .opam-env
270+
const fs = require('fs/promises');
271+
await fs.writeFile('.opam-path', opamPath, 'utf-8');
272+
console.log('stored path to .opam-path');
278273
279274
- name: Install OPAM dependencies
280275
if: steps.cache-opam-env.outputs.cache-hit != 'true'
@@ -289,10 +284,9 @@ jobs:
289284
~/.opam
290285
_opam
291286
.opam-path
292-
.opam-env
293287
D:\cygwin
294288
D:\.opam
295-
key: opam-env-v8-${{ matrix.os }}-${{ hashFiles('dune-project') }}
289+
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }}
296290

297291
- name: Use cached OPAM environment
298292
if: steps.cache-opam-env.outputs.cache-hit == 'true'
@@ -308,15 +302,14 @@ jobs:
308302
if [[ "$RUNNER_OS" != "Windows" ]]; then
309303
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV"
310304
else
311-
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
305+
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV"
312306
fi
313307
314-
if [[ "$RUNNER_OS" != "Windows" ]]; then
315-
OPAM_PATH="$(cat .opam-path)"
316-
chmod +x "$OPAM_PATH"
317-
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
308+
OPAM_PATH="$(cat .opam-path)"
309+
chmod +x "$OPAM_PATH"
310+
dirname "$OPAM_PATH" >> "$GITHUB_PATH"
318311
319-
else
312+
if [[ "$RUNNER_OS" == "Windows" ]]; then
320313
fsutil behavior query SymlinkEvaluation
321314
fsutil behavior set symlinkEvaluation R2L:1 R2R:1
322315
fsutil behavior query SymlinkEvaluation
@@ -365,6 +358,8 @@ jobs:
365358
- name: "Check if syntax subfolder has changed"
366359
id: syntax-diff
367360
shell: bash
361+
env:
362+
SHELLOPTS: igncr # see https://github.com/ocaml/setup-ocaml/issues/815
368363
run: |
369364
if git diff --name-only --exit-code HEAD^ HEAD -- jscomp/syntax; then
370365
echo "syntax_status=unchanged" >> $GITHUB_ENV
@@ -519,7 +514,9 @@ jobs:
519514
path: packages/test
520515

521516
- name: Install ReScript package
522-
run: npm i rescript-${{ needs.package.outputs.rescript_version }}.tgz
517+
run: |
518+
npm i --ignore-scripts --no-audit \
519+
rescript-${{ needs.package.outputs.rescript_version }}.tgz
523520
shell: bash
524521
working-directory: packages/test
525522

0 commit comments

Comments
 (0)