Remove Js.Vector
and Js.List
#4343
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [master, 11.0_release] | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-*" | |
pull_request: | |
branches: [master, 11.0_release] | |
concurrency: | |
group: ci-${{ github.ref }}-1 | |
# Cancel previous builds for pull requests only. | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
env: | |
OCAMLRUNPARAM: b | |
jobs: | |
build-rewatch: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
macos-13, # x64 | |
macos-14, # ARM | |
ubuntu-latest, # x64 | |
buildjet-2vcpu-ubuntu-2204-arm, # ARM | |
windows-latest, | |
] | |
include: | |
- os: macos-13 | |
rust-target: x86_64-apple-darwin | |
- os: macos-14 | |
rust-target: aarch64-apple-darwin | |
- os: ubuntu-latest | |
rust-target: x86_64-unknown-linux-musl | |
- os: buildjet-2vcpu-ubuntu-2204-arm | |
rust-target: aarch64-unknown-linux-musl | |
- os: windows-latest | |
rust-target: x86_64-pc-windows-gnu | |
runs-on: ${{matrix.os}} | |
env: | |
RUST_BACKTRACE: "1" | |
SCCACHE_GHA_ENABLED: "true" | |
RUSTC_WRAPPER: "sccache" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore build cache | |
id: build-cache | |
uses: actions/cache@v4 | |
with: | |
path: rewatch/target | |
key: rewatch-build-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }} | |
- name: Install musl gcc | |
if: steps.build-cache.outputs.cache-hit != 'true' && runner.os == 'Linux' | |
run: sudo apt-get install -y --no-install-recommends musl-tools | |
- name: Set up sccache | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
uses: mozilla-actions/[email protected] | |
with: | |
version: "v0.8.0" | |
- name: Install rust toolchain | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
targets: ${{matrix.rust-target}} | |
- name: Build rewatch | |
if: steps.build-cache.outputs.cache-hit != 'true' | |
run: cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release | |
- name: Get artifact dir name | |
run: node .github/workflows/get_artifact_dir_name.js | |
- name: "Upload artifact: rewatch binary" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rewatch-${{env.artifact_dir_name}} | |
path: rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} | |
# Build statically linked Linux binaries in an Alpine-based Docker container | |
# See https://ocamlpro.com/blog/2021_09_02_generating_static_and_portable_executables_with_ocaml | |
# for more info. | |
# The container already comes with all required tools pre-installed | |
# (see https://github.com/rescript-lang/docker-rescript-ci-build/blob/main/Dockerfile). | |
static-binaries-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, buildjet-2vcpu-ubuntu-2204-arm] | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build compiler binaries | |
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 | |
with: | |
args: opam exec -- dune build --display quiet --profile static | |
- name: Build ninja binary | |
uses: docker://ghcr.io/rescript-lang/rescript-ci-build:alpine-3.20-ocaml-5.2.0-01 | |
with: | |
args: sh -c "cd ninja && LDFLAGS=-static python configure.py --bootstrap" | |
- name: "Upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: static-binaries-linux-${{runner.arch}} | |
path: | | |
_build/install/default/bin | |
ninja/ninja | |
# The full build including tests does not work on Linux ARM because setup-ocaml fails. | |
# Therefore, only upload the binaries from the static build | |
upload-linux-arm64-binaries: | |
needs: | |
- build-rewatch | |
- static-binaries-linux | |
runs-on: buildjet-2vcpu-ubuntu-2204-arm | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download static linux binaries | |
if: runner.os == 'Linux' | |
uses: actions/download-artifact@v4 | |
with: | |
name: static-binaries-linux-${{ runner.arch }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Get artifact dir name | |
run: node .github/workflows/get_artifact_dir_name.js | |
- name: Download rewatch binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: rewatch-${{ env.artifact_dir_name }} | |
path: rewatch | |
- name: Copy exes to platform bin dirs | |
run: node ./scripts/copyExes.js | |
- name: "Upload artifacts: binaries" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ env.artifact_dir_name }} | |
path: ${{ env.artifact_dir_name }} | |
build: | |
needs: | |
- build-rewatch | |
- static-binaries-linux | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
macos-13, # x64 | |
macos-14, # ARM | |
ubuntu-latest, | |
windows-latest, | |
] | |
ocaml_compiler: [5.2.0] | |
runs-on: ${{matrix.os}} | |
env: | |
# setup-ocaml opam version cannot be configured | |
# we do track its version mannually | |
OPAM_VERSION: 2.2.0 | |
DUNE_PROFILE: release | |
steps: | |
- name: "Windows: Set git to use LF" | |
if: runner.os == 'Windows' | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 # to be able to check for changes in subfolder jscomp/syntax later | |
- name: Download static linux binaries | |
if: runner.os == 'Linux' | |
uses: actions/download-artifact@v4 | |
with: | |
name: static-binaries-linux-${{ runner.arch }} | |
- name: Get artifact dir name | |
run: node .github/workflows/get_artifact_dir_name.js | |
- name: Download rewatch binary | |
uses: actions/download-artifact@v4 | |
with: | |
name: rewatch-${{ env.artifact_dir_name }} | |
path: rewatch | |
- name: Make static linux binaries executable | |
if: runner.os == 'Linux' | |
run: | | |
chmod +x ninja/ninja | |
chmod +x rewatch/rewatch | |
chmod +x _build/install/default/bin/* | |
- name: Install dependencies (Linux) | |
if: runner.os == 'Linux' | |
uses: awalsh128/[email protected] | |
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: v1 | |
- name: Setup Python for ninja build | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Restore OPAM environment | |
id: cache-opam-env | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ runner.tool_cache }}/opam | |
~/.opam | |
_opam | |
.opam-path | |
D:\cygwin | |
D:\.opam | |
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }} | |
- name: Use OCaml ${{matrix.ocaml_compiler}} | |
uses: ocaml/[email protected] | |
if: steps.cache-opam-env.outputs.cache-hit != 'true' | |
with: | |
ocaml-compiler: ${{matrix.ocaml_compiler}} | |
opam-pin: false | |
- name: Get OPAM executable path | |
if: steps.cache-opam-env.outputs.cache-hit != 'true' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const opamPath = await io.which('opam', true); | |
console.log('opam executable found: %s', opamPath); | |
const fs = require('fs/promises'); | |
await fs.writeFile('.opam-path', opamPath, 'utf-8'); | |
console.log('stored path to .opam-path'); | |
- name: Install OPAM dependencies | |
if: steps.cache-opam-env.outputs.cache-hit != 'true' | |
run: opam install . --deps-only | |
- name: Cache OPAM environment | |
if: steps.cache-opam-env.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
${{ runner.tool_cache }}/opam | |
~/.opam | |
_opam | |
.opam-path | |
D:\cygwin | |
D:\.opam | |
key: opam-env-v1-${{ matrix.os }}-${{ matrix.ocaml_compiler }}-${{ hashFiles('dune-project') }} | |
- 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" | |
if [[ "$RUNNER_OS" != "Windows" ]]; then | |
echo "OPAMROOT=$HOME/.opam" >> "$GITHUB_ENV" | |
else | |
echo "OPAMROOT=D:\\.opam" >> "$GITHUB_ENV" | |
fi | |
OPAM_PATH="$(cat .opam-path)" | |
chmod +x "$OPAM_PATH" | |
dirname "$OPAM_PATH" >> "$GITHUB_PATH" | |
if [[ "$RUNNER_OS" == "Windows" ]]; then | |
fsutil behavior query SymlinkEvaluation | |
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" | |
fi | |
shell: bash | |
- name: Build compiler | |
if: runner.os != 'Linux' | |
run: opam exec -- dune build --display quiet --profile release | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Install npm packages | |
run: npm ci --ignore-scripts | |
- name: Setup MSVC for ninja build (Windows) | |
if: runner.os == 'Windows' | |
uses: TheMrMilchmann/setup-msvc-dev@v3 | |
with: | |
arch: x64 | |
- name: Build ninja | |
if: runner.os != 'Linux' | |
run: node scripts/buildNinjaBinary.js | |
- name: Copy exes to platform bin dirs | |
run: node ./scripts/copyExes.js | |
- name: "Check if syntax subfolder has changed" | |
id: syntax-diff | |
shell: bash | |
env: | |
SHELLOPTS: igncr # see https://github.com/ocaml/setup-ocaml/issues/815 | |
run: | | |
if git diff --name-only --exit-code HEAD^ HEAD -- jscomp/syntax; then | |
echo "syntax_status=unchanged" >> $GITHUB_ENV | |
else | |
echo "syntax_status=changed" >> $GITHUB_ENV | |
fi | |
- name: "Syntax: Run roundtrip tests" | |
if: ${{ env.syntax_status == 'changed' && runner.os != 'Windows' }} | |
run: opam exec -- make test-syntax-roundtrip | |
- name: "Syntax: Run tests (Windows)" | |
if: ${{ env.syntax_status == 'changed' && runner.os == 'Windows' }} | |
run: opam exec -- make test-syntax | |
- name: Build runtime/stdlib | |
if: runner.os != 'Windows' | |
run: | | |
opam exec -- node ./scripts/ninja.js config | |
opam exec -- node ./scripts/ninja.js build | |
- name: Check for changes in lib folder | |
run: git diff --exit-code lib/js lib/es6 | |
- name: Populate lib/ocaml | |
run: ./scripts/prebuilt.js | |
- name: Run tests | |
if: runner.os != 'Windows' | |
run: node scripts/ciTest.js -all | |
- name: Run gentype tests | |
if: runner.os != 'Windows' | |
run: make -C jscomp/gentype_tests/typescript-react-example clean test | |
- name: Run tests (Windows) | |
if: runner.os == 'Windows' | |
run: node scripts/ciTest.js -mocha -theme -format | |
# Build the playground compiler on the fastest runner (ubuntu-latest) | |
- name: Build playground compiler | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js | |
opam exec -- dune build --profile browser | |
cp ./_build/default/jscomp/jsoo/jsoo_playground_main.bc.js playground/compiler.js | |
- name: Test playground compiler | |
if: matrix.os == 'ubuntu-latest' | |
run: node playground/playground_test.js | |
- name: Upload playground compiler to CDN | |
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v') }} | |
env: | |
KEYCDN_USER: ${{ secrets.KEYCDN_USER }} | |
KEYCDN_PASSWORD: ${{ secrets.KEYCDN_PASSWORD }} | |
run: bash playground/upload_bundle.sh | |
- name: "Upload artifacts: binaries" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ env.artifact_dir_name }} | |
path: ${{ env.artifact_dir_name }} | |
- name: "Upload artifacts: lib/ocaml" | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib-ocaml | |
path: lib/ocaml | |
package: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: NPM install | |
run: npm ci --ignore-scripts | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: "@(binaries-*|lib-ocaml)" | |
- name: Move artifacts | |
run: ./scripts/moveArtifacts.sh | |
- name: Check artifact list | |
run: node ./scripts/makeArtifactList.js -check | |
- name: npm pack (rescript) | |
run: npm pack | |
- name: Copy JS files to stdlib package | |
run: mkdir -p packages/std/lib && cp -R lib/es6 lib/js packages/std/lib | |
- name: npm pack (@rescript/std) | |
run: npm pack | |
working-directory: packages/std | |
- name: Prepare package upload | |
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit. | |
run: node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }} | |
- name: "Upload artifact: npm packages" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: npm-packages | |
path: | | |
rescript-${{ env.rescript_version }}.tgz | |
rescript-std-${{ env.rescript_version }}.tgz | |
outputs: | |
rescript_version: ${{ env.rescript_version }} | |
installationTest: | |
needs: package | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
macos-13, # x64 | |
macos-14, # ARM | |
ubuntu-latest, | |
buildjet-2vcpu-ubuntu-2204-arm, | |
windows-latest, | |
] | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: npm-packages | |
path: packages/test | |
- name: Install ReScript package | |
run: | | |
npm i --ignore-scripts --no-audit \ | |
rescript-${{ needs.package.outputs.rescript_version }}.tgz | |
shell: bash | |
working-directory: packages/test | |
- name: Test installation | |
run: npx rescript -h && npx rescript build && cat src/Test.bs.js | |
shell: bash | |
working-directory: packages/test | |
publish: | |
needs: [package, installationTest] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org # Needed to make auth work for publishing | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: npm-packages | |
- name: Publish packages on npm with tag "ci" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
npm publish rescript-${{ needs.package.outputs.rescript_version }}.tgz --tag ci | |
npm publish rescript-std-${{ needs.package.outputs.rescript_version }}.tgz --tag ci | |
- name: Update Website Playground | |
env: | |
NEXT_REVALIDATE_SECRET_TOKEN: ${{ secrets.NEXT_REVALIDATE_SECRET_TOKEN }} | |
run: ./playground/website_update_playground.sh | |
shell: bash |