From 0d7dd29fafc8877311ec6299ea2baa717cc39c56 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 18 Jul 2025 18:51:18 +0200 Subject: [PATCH 1/4] Clean up env vars --- .github/workflows/ci.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab533045a1..8173770740 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ concurrency: env: OCAMLRUNPARAM: b + RUST_BACKTRACE: "1" jobs: build-compiler: @@ -74,13 +75,6 @@ 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" - steps: - name: "Windows: Set git config" if: runner.os == 'Windows' @@ -546,8 +540,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 @@ -597,8 +589,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 @@ -652,8 +642,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 From c3b3c3c5e9a7b8316b17f2b2f79d38ef72fbc066 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 18 Jul 2025 18:40:18 +0200 Subject: [PATCH 2/4] Log environment info --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8173770740..5db5c1210a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -234,6 +234,13 @@ jobs: 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 From 4b37c363e3d1a0db5aa0e3946d47188df9fe1f90 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Sat, 19 Jul 2025 08:14:11 +0200 Subject: [PATCH 3/4] Adjust OPAM vars to latest setup-ocaml --- .github/workflows/ci.yml | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5db5c1210a..0199e0d3e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -195,13 +195,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" @@ -218,19 +222,9 @@ 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 From 1613dc4c97c36e18acb3455b67f1fad86979e72d Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Fri, 18 Jul 2025 16:58:15 +0200 Subject: [PATCH 4/4] OPAM 2.4.0 --- .github/workflows/ci.yml | 24 +++++++++++++++++------- CONTRIBUTING.md | 7 +++++-- rescript.opam.template | 2 ++ 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0199e0d3e1..ec6c7e0e18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,11 @@ jobs: runs-on: ${{matrix.os}} + env: + # 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" if: runner.os == 'Windows' @@ -100,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 @@ -141,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 @@ -157,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}} @@ -175,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' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 320c657290..aa38009774 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 ``` @@ -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: diff --git a/rescript.opam.template b/rescript.opam.template index ffc4578a2d..15bf1da5e5 100644 --- a/rescript.opam.template +++ b/rescript.opam.template @@ -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"] ]