Skip to content

OPAM 2.4.0 #7668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 35 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:

env:
OCAMLRUNPARAM: b
RUST_BACKTRACE: "1"

jobs:
build-compiler:
Expand Down Expand Up @@ -75,11 +76,9 @@ jobs:
runs-on: ${{matrix.os}}

env:
# setup-ocaml opam version cannot be configured
# we do track its version manually
OPAM_VERSION: 2.3.0
DUNE_PROFILE: release
RUST_BACKTRACE: "1"
# When changing the setup-ocaml version, also adjust it in the setup step further below
# and update the comment about the OPAM version if it changed.
SETUP_OCAML_VERSION: 3.4.0 # comes with OPAM 2.4.0

steps:
- name: "Windows: Set git config"
Expand All @@ -106,11 +105,12 @@ jobs:

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

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

- name: Restore OPAM environment
id: cache-opam-env
Expand All @@ -163,7 +163,7 @@ jobs:
key: ${{ env.opam_cache_key }}

- name: Use OCaml ${{matrix.ocaml_compiler}}
uses: ocaml/setup-ocaml@v3.3.2
uses: ocaml/setup-ocaml@v3.4.0
if: steps.cache-opam-env.outputs.cache-hit != 'true'
with:
ocaml-compiler: ${{matrix.ocaml_compiler}}
Expand All @@ -181,9 +181,13 @@ jobs:
await fs.writeFile('.opam-path', opamPath, 'utf-8');
console.log('stored path to .opam-path');

# With OPAM 2.4, it is not sufficient to have the flow-parser package in `pin-depends` in rescript.opam.template,
# we need to pin it explicitly using `opam pin add`.
- name: Install OPAM dependencies
if: steps.cache-opam-env.outputs.cache-hit != 'true'
run: opam install . --deps-only --with-test
run: |
opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action
opam install . --deps-only --with-test

- name: Cache OPAM environment
if: steps.cache-opam-env.outputs.cache-hit != 'true'
Expand All @@ -201,13 +205,17 @@ jobs:
- name: Use cached OPAM environment
if: steps.cache-opam-env.outputs.cache-hit == 'true'
run: |
# https://github.com/ocaml/setup-ocaml/blob/b2105f9/packages/setup-ocaml/src/installer.ts#L33
echo "OPAMVERBOSE=$RUNNER_DEBUG" >> "$GITHUB_ENV"
echo "OPAMCOLOR=always" >> "$GITHUB_ENV"
echo "OPAMCONFIRMLEVEL=unsafe-yes" >> "$GITHUB_ENV"
echo "OPAMERRLOGLEN=0" >> "$GITHUB_ENV"
echo "OPAMPRECISETRACKING=1" >> "$GITHUB_ENV"
echo "OPAMYES=1" >> "$GITHUB_ENV"
# https://github.com/ocaml/setup-ocaml/blob/1629342/packages/setup-ocaml/src/installer.ts#L36
echo "OPAMVERBOSE=$RUNNER_DEBUG" >> "$GITHUB_ENV"
echo "OPAMCOLOR=always" >> "$GITHUB_ENV"
echo "OPAMCONFIRMLEVEL=unsafe-yes" >> "$GITHUB_ENV"
echo "OPAMDOWNLOADJOBS=4" >> "$GITHUB_ENV"
echo "OPAMERRLOGLEN=0" >> "$GITHUB_ENV"
echo "OPAMEXTERNALSOLVER=unsafe-yes" >> "$GITHUB_ENV"
echo "OPAMPRECISETRACKING=1" >> "$GITHUB_ENV"
echo "OPAMRETRIES=10" >> "$GITHUB_ENV"
echo "OPAMSOLVERTIMEOUT=600" >> "$GITHUB_ENV"
echo "OPAMYES=1" >> "$GITHUB_ENV"

if [[ "$RUNNER_OS" != "Windows" ]]; then
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV"
Expand All @@ -224,22 +232,19 @@ jobs:
fsutil behavior set symlinkEvaluation R2L:1 R2R:1
fsutil behavior query SymlinkEvaluation

CYGWIN="winsymlinks:native"
CYGWIN_ROOT="D:\\cygwin"
CYGWIN_ROOT_BIN="D:\\cygwin\\bin"
CYGWIN_ROOT_WRAPPERBIN="D:\\cygwin\\wrapperbin"

echo "HOME=$USERPROFILE" >> "$GITHUB_ENV"
echo "MSYS=winsymlinks:native" >> "$GITHUB_ENV"
echo "CYGWIN=$CYGWIN" >> "$GITHUB_ENV"
echo "CYGWIN_ROOT=$CYGWIN_ROOT" >> "$GITHUB_ENV"
echo "CYGWIN_ROOT_BIN=$CYGWIN_ROOT_BIN" >> "$GITHUB_ENV"
echo "CYGWIN_ROOT_WRAPPERBIN=$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_ENV"

echo "$CYGWIN_ROOT_WRAPPERBIN" >> "$GITHUB_PATH"
echo "CYGWIN=winsymlinks:native" >> "$GITHUB_ENV"
fi
shell: bash

- name: Log environment info
run: |
echo OPAM version: $(opam --version)
echo System: $(uname -s)
echo Path: $PATH
shell: bash

- name: Compiler build state key
id: compiler-build-state-key
shell: bash
Expand Down Expand Up @@ -546,8 +551,6 @@ jobs:
- os: ubuntu-24.04-arm
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -597,8 +600,6 @@ jobs:
- os: ubuntu-24.04-arm
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: "1"
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
Expand Down Expand Up @@ -652,8 +653,6 @@ jobs:
- os: ubuntu-24.04-arm
- os: windows-latest
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ opam init
# then you need to run `opam update && opam upgrade` first
opam switch create 5.3.0

# Install dev dependencies from OPAM
# Pin flow parser
opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action

# Install dependencies from OPAM, including dev/test dependencies
opam install . --deps-only --with-test --with-dev-setup -y
```

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

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

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.
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.

Follow the instructions from the comment, which are like:

Expand Down
2 changes: 2 additions & 0 deletions rescript.opam.template
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ depends: [
"wasm_of_ocaml-compiler" {os != "win32" & with-test & = "6.0.1"}
]
pin-depends: [
# If using OPAM 2.4.0, this also needs to be pre-pinned using
# opam pin add flow_parser git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b --no-action
["flow_parser.0.267.0" "git+https://github.com/rescript-lang/flow.git#9ea4062c0b7e037415c4413a7634c459ebd5c31b"]
]
Loading