Skip to content
Merged
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
126 changes: 48 additions & 78 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,11 @@ jobs:
push: never
runCmd: make

test-installation-npm:
# Installs the packages published by pkg-pr-new with npm, then with pnpm,
# each in a directory of its own. One job per OS rather than one per
# package manager halves the jobs that wait for a runner, macOS runners
# in particular.
test-installation:
needs:
- pkg-pr-new
strategy:
Expand All @@ -653,33 +657,40 @@ jobs:
- os: windows-2025
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10

- name: Use Node.js
uses: actions/setup-node@v7
with:
# Run integration tests with the oldest supported node version.
node-version: 22

- name: Make test directory
- name: Checkout
uses: actions/checkout@v7

- name: Make test directories
id: tmp-dir
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
dir=$(powershell -Command "[System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()" | tr -d '\r')
mkdir -p "$dir"
else
dir=$(mktemp -d)
fi
echo "path=$dir" >> "$GITHUB_OUTPUT"
cp -r tests/package_tests/installation_test/* "$dir"
# The compiled stdlib tests run against the installed runtime. Their
# Test.mjs imports @babel/code-frame, which tests/tests depends on.
cp -r tests/tests/src/stdlib "$dir/stdlib"
for manager in npm pnpm; do
if [[ "$RUNNER_OS" == "Windows" ]]; then
dir=$(powershell -Command "[System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()" | tr -d '\r')
mkdir -p "$dir"
else
dir=$(mktemp -d)
fi
echo "$manager=$dir" >> "$GITHUB_OUTPUT"
cp -r tests/package_tests/installation_test/* "$dir"
# The compiled stdlib tests run against the installed runtime. Their
# Test.mjs imports @babel/code-frame, which tests/tests depends on.
cp -r tests/tests/src/stdlib "$dir/stdlib"
done
echo "code-frame=$(node -p 'require("./tests/tests/package.json").dependencies["@babel/code-frame"]')" >> "$GITHUB_OUTPUT"

- name: Install ReScript package
- name: "npm: Install ReScript package"
run: |
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
npm i --no-audit \
Expand All @@ -688,9 +699,9 @@ jobs:
"https://pkg.pr.new/rescript-lang/rescript/@rescript/belt@${COMMIT_SHA}" \
"@babel/code-frame@${{ steps.tmp-dir.outputs.code-frame }}"
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.npm }}

- name: Test installation
- name: "npm: Test installation"
run: |
npx rescript -h
npx rescript build
Expand All @@ -703,68 +714,28 @@ jobs:
npx rescript build
node src/BeltTest.mjs
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.npm }}

- name: Test packaged CLI subcommands and watch shutdown
- name: "npm: Test packaged CLI subcommands and watch shutdown"
run: node packaged-cli-smoke.mjs
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.npm }}

# build-compiler runs the stdlib tests on the Node.js version in .nvmrc,
# this job on the oldest supported one, so tests of APIs missing there
# must stay out of Stdlib_TestSuite and Stdlib_TempTests.
- name: Run stdlib tests
- name: "npm: Run stdlib tests"
run: |
node stdlib/Stdlib_TestSuite.mjs
node stdlib/Stdlib_TempTests.mjs
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.npm }}

test-installation-pnpm:
needs:
- pkg-pr-new
strategy:
fail-fast: false
matrix:
include:
- os: macos-26
- os: ubuntu-26.04
- os: ubuntu-26.04-arm
- os: windows-2025
runs-on: ${{ matrix.os }}
steps:
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10

- name: Use Node.js
uses: actions/setup-node@v7
with:
# Run integration tests with the oldest supported node version.
node-version: 22

- name: Checkout
uses: actions/checkout@v7

- name: Make test directory
id: tmp-dir
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
dir=$(powershell -Command "[System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()" | tr -d '\r')
mkdir -p "$dir"
else
dir=$(mktemp -d)
fi
echo "path=$dir" >> "$GITHUB_OUTPUT"
cp -r tests/package_tests/installation_test/* "$dir"
# The compiled stdlib tests run against the installed runtime. Their
# Test.mjs imports @babel/code-frame, which tests/tests depends on.
cp -r tests/tests/src/stdlib "$dir/stdlib"
echo "code-frame=$(node -p 'require("./tests/tests/package.json").dependencies["@babel/code-frame"]')" >> "$GITHUB_OUTPUT"

- name: Install ReScript package
# The pnpm steps run even when an npm step failed, so that one run
# reports both package managers.
- name: "pnpm: Install ReScript package"
id: pnpm-install
if: ${{ !cancelled() && steps.tmp-dir.outcome == 'success' }}
run: |
COMMIT_SHA="${{ needs.pkg-pr-new.outputs.commit_sha }}"
# pnpm 10 blocks pkg.pr.new's URL-based platform subdependencies unless block-exotic-subdeps is disabled.
Expand All @@ -774,9 +745,11 @@ jobs:
"https://pkg.pr.new/rescript-lang/rescript/@rescript/belt@${COMMIT_SHA}" \
"@babel/code-frame@${{ steps.tmp-dir.outputs.code-frame }}"
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.pnpm }}

- name: Test installation
- name: "pnpm: Test installation"
id: pnpm-test
if: ${{ !cancelled() && steps.pnpm-install.outcome == 'success' }}
run: |
pnpm rescript -h
pnpm rescript build
Expand All @@ -789,17 +762,15 @@ jobs:
pnpm rescript build
node src/BeltTest.mjs
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.pnpm }}

# build-compiler runs the stdlib tests on the Node.js version in .nvmrc,
# this job on the oldest supported one, so tests of APIs missing there
# must stay out of Stdlib_TestSuite and Stdlib_TempTests.
- name: Run stdlib tests
- name: "pnpm: Run stdlib tests"
if: ${{ !cancelled() && steps.pnpm-test.outcome == 'success' }}
run: |
node stdlib/Stdlib_TestSuite.mjs
node stdlib/Stdlib_TempTests.mjs
shell: bash
working-directory: ${{ steps.tmp-dir.outputs.path }}
working-directory: ${{ steps.tmp-dir.outputs.pnpm }}

# The single CI check that the master ruleset requires. Matrix job names
# contain runner labels, so requiring this job instead keeps the ruleset
Expand All @@ -812,8 +783,7 @@ jobs:
- pkg-pr-new
- api-docs
- test-devcontainer
- test-installation-npm
- test-installation-pnpm
- test-installation
runs-on: ubuntu-26.04
steps:
- name: Check that all needed jobs succeeded
Expand Down
Loading