Skip to content

Commit a63d2dc

Browse files
committed
OPAM 2.4.0
1 parent 4b37c36 commit a63d2dc

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ jobs:
7575

7676
runs-on: ${{matrix.os}}
7777

78+
env:
79+
# Also adjust in `uses:` when changed!
80+
# This version of setup-ocaml comes with OPAM 2.4.0.
81+
SETUP_OCAML_VERSION: 3.4.0
82+
7883
steps:
7984
- name: "Windows: Set git config"
8085
if: runner.os == 'Windows'
@@ -100,11 +105,12 @@ jobs:
100105

101106
- name: Install dependencies (Linux)
102107
if: runner.os == 'Linux'
103-
uses: awalsh128/cache-apt-pkgs-action@v1.4.3
108+
uses: awalsh128/cache-apt-pkgs-action@v1.5.1
104109
with:
105-
# See https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/unix.ts#L9
106-
packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync
107-
version: v3
110+
# https://github.com/ocaml/setup-ocaml/blob/2f57267f071bc8547dfcb9433ff21d44fffef190/packages/setup-ocaml/src/unix.ts#L48
111+
# plus OPAM wants cmake
112+
packages: bubblewrap darcs g++-multilib gcc-multilib mercurial musl-tools rsync cmake
113+
version: v4
108114

109115
- name: Restore rewatch build cache
110116
id: rewatch-build-cache
@@ -141,7 +147,7 @@ jobs:
141147
# matrix.ocaml_compiler may contain commas
142148
- name: Get OPAM cache key
143149
shell: bash
144-
run: echo "opam_cache_key=opam-env-v8-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" | sed 's/,/-/g' >> $GITHUB_ENV
150+
run: echo "opam_cache_key=opam-env-v8-${{ matrix.os }}-${{ env.SETUP_OCAML_VERSION }}-{{ matrix.ocaml_compiler }}-${{ hashFiles('*.opam') }}" | sed 's/,/-/g' >> $GITHUB_ENV
145151

146152
- name: Restore OPAM environment
147153
id: cache-opam-env
@@ -157,7 +163,7 @@ jobs:
157163
key: ${{ env.opam_cache_key }}
158164

159165
- name: Use OCaml ${{matrix.ocaml_compiler}}
160-
uses: ocaml/setup-ocaml@v3.3.2
166+
uses: ocaml/setup-ocaml@v3.4.0
161167
if: steps.cache-opam-env.outputs.cache-hit != 'true'
162168
with:
163169
ocaml-compiler: ${{matrix.ocaml_compiler}}
@@ -175,9 +181,13 @@ jobs:
175181
await fs.writeFile('.opam-path', opamPath, 'utf-8');
176182
console.log('stored path to .opam-path');
177183
184+
# With OPAM 2.4, it is not sufficient to have the flow-parser package in `pin-depends` in rescript.opam.template,
185+
# we need to pin it explicitly using `opam pin add`.
178186
- name: Install OPAM dependencies
179187
if: steps.cache-opam-env.outputs.cache-hit != 'true'
180-
run: opam install . --deps-only --with-test
188+
run: |
189+
opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action
190+
opam install . --deps-only --with-test
181191
182192
- name: Cache OPAM environment
183193
if: steps.cache-opam-env.outputs.cache-hit != 'true'

CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ opam init
5353
# then you need to run `opam update && opam upgrade` first
5454
opam switch create 5.3.0
5555

56-
# Install dev dependencies from OPAM
56+
# Pin flow parser
57+
opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action
58+
59+
# Install dependencies from OPAM, including dev/test dependencies
5760
opam install . --deps-only --with-test --with-dev-setup -y
5861
```
5962

@@ -397,7 +400,7 @@ To build a new version and release it on NPM, follow these steps:
397400

398401
To reproduce issues, it can be helpful to the team to install a specific version of the compiler.
399402

400-
ReScript uses [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new) for continuous releases. Once tests are passed successfully, the bot comment is available.
403+
ReScript uses [pkg.pr.new](https://github.com/stackblitz-labs/pkg.pr.new) for continuous releases. Once tests are passed successfully, the bot comment is available.
401404

402405
Follow the instructions from the comment, which are like:
403406

rescript.opam.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ depends: [
1414
"wasm_of_ocaml-compiler" {os != "win32" & with-test & = "6.0.1"}
1515
]
1616
pin-depends: [
17+
# If using OPAM 2.4.0, this also needs to be pre-pinned using
18+
# opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action
1719
["flow_parser.0.267.0" "git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b"]
1820
]

0 commit comments

Comments
 (0)