-
Notifications
You must be signed in to change notification settings - Fork 468
Per-platform binary packages #7395
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
Merged
+717
−364
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
6451c4b
wip
cometkim 22e361d
per-platform packages
cometkim dda6eae
fix gentype makefile
cometkim 3458e98
change binary package exports
cometkim 4762a8c
use yarn pack
cometkim 25571d7
upload platform artifacts
cometkim dc2288b
fix format
cometkim 5f1886d
fix flag
cometkim 7f6526d
suppress warnings from biome
cometkim 8c4d743
expose bsb_helper path
cometkim 821d418
compute realpath of binaries as needed
cometkim 38bfc2d
reduce lstats in tests
cometkim f2028c0
exclude unintended path from packages
cometkim 73435ef
fix package script
cometkim 51d815a
fix installation test
cometkim 27c6e67
add typescript declarations
cometkim 44f132a
tmp: search stdlib
cometkim 8b1468d
sync versions
cometkim 1dd4706
gotcha
cometkim e76f956
a bit safer
cometkim 3e628f2
it shound't be symlinks
cometkim 934fe83
Overlapped bin entries is not compatibile with the mult-arch config
cometkim cdae7dc
workaround for executable permission
cometkim fc41236
actually not needed
cometkim 367d899
update lockfile
cometkim d9e5259
handle path correctly
cometkim e915fa0
remove symlinks
cometkim ddd18af
fix
cometkim a6fdc01
use workspace protocol, less burden
cometkim fd92bc5
make ninja task recoverable without rebuild
cometkim 496611a
refactor using readline
cometkim d566a6f
add changelog
cometkim 0be8f48
add note about resolutions override for testing
cometkim b93bdaf
Update CHANGELOG.md
cometkim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,14 +27,19 @@ jobs: | |
include: | ||
- os: macos-13 # x64 | ||
rust-target: x86_64-apple-darwin | ||
node-target: darwin-x64 | ||
- os: macos-14 # ARM | ||
rust-target: aarch64-apple-darwin | ||
node-target: darwin-arm64 | ||
- os: ubuntu-24.04 # x64 | ||
rust-target: x86_64-unknown-linux-musl | ||
node-target: linux-x64 | ||
- os: ubuntu-24.04-arm # ARM | ||
rust-target: aarch64-unknown-linux-musl | ||
node-target: linux-arm64 | ||
- os: windows-latest | ||
rust-target: x86_64-pc-windows-gnu | ||
node-target: win32-x64 | ||
|
||
runs-on: ${{matrix.os}} | ||
|
||
|
@@ -66,25 +71,24 @@ jobs: | |
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: stable | ||
targets: ${{matrix.rust-target}} | ||
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: Copy rewatch exe to platform bin dir | ||
run: | | ||
cp rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch | ||
node ./scripts/copyExes.js -rewatch | ||
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: Copy rewatch binary | ||
run: | | ||
cp rewatch/target/${{ matrix.rust-target }}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }} rewatch.exe | ||
shell: bash | ||
|
||
- name: "Upload artifact: rewatch binary" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: rewatch-${{env.artifact_dir_name}} | ||
path: ${{ env.artifact_dir_name }} | ||
name: rewatch-${{ matrix.node-target }} | ||
path: rewatch.exe | ||
if-no-files-found: error | ||
|
||
build-compiler: | ||
strategy: | ||
|
@@ -95,21 +99,26 @@ jobs: | |
ocaml_compiler: ocaml-variants.5.3.0+options,ocaml-option-static | ||
upload_binaries: true | ||
upload_libs: true | ||
node-target: linux-x64 | ||
- os: ubuntu-24.04-arm # ARM | ||
ocaml_compiler: ocaml-variants.5.3.0+options,ocaml-option-static | ||
upload_binaries: true | ||
# Build the playground compiler and run the benchmarks on the fastest runner | ||
build_playground: true | ||
benchmarks: true | ||
node-target: linux-arm64 | ||
- os: macos-13 # x64 | ||
ocaml_compiler: 5.3.0 | ||
upload_binaries: true | ||
node-target: darwin-x64 | ||
- os: macos-14 # ARM | ||
ocaml_compiler: 5.3.0 | ||
upload_binaries: true | ||
node-target: darwin-arm64 | ||
- os: windows-latest | ||
ocaml_compiler: 5.3.0 | ||
upload_binaries: true | ||
node-target: win32-x64 | ||
|
||
# Verify that the compiler still builds with older OCaml versions | ||
- os: ubuntu-24.04 | ||
|
@@ -144,9 +153,6 @@ jobs: | |
cache: yarn | ||
node-version-file: .nvmrc | ||
|
||
- name: Get artifact dir name | ||
run: node .github/workflows/get_artifact_dir_name.js | ||
|
||
- name: Install dependencies (Linux) | ||
if: runner.os == 'Linux' | ||
uses: awalsh128/[email protected] | ||
|
@@ -303,13 +309,13 @@ jobs: | |
run: yarn install | ||
|
||
- name: Copy compiler exes to platform bin dir | ||
run: node ./scripts/copyExes.js -compiler | ||
run: node scripts/copyExes.js --compiler | ||
|
||
- name: Restore ninja build cache | ||
id: ninja-build-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.artifact_dir_name }}/ninja.exe | ||
path: packages/@rescript/${{ matrix.node-target }}/bin/ninja.exe | ||
key: ninja-build-v1-${{ matrix.os }}-${{ hashFiles('ninja/src/**') }} | ||
|
||
- name: Setup Python for ninja build | ||
|
@@ -336,7 +342,7 @@ jobs: | |
|
||
- name: Copy ninja exe to platform bin dir | ||
if: steps.ninja-build-cache.outputs.cache-hit != 'true' | ||
run: node ./scripts/copyExes.js -ninja | ||
run: node scripts/copyExes.js --ninja | ||
|
||
- name: "Syntax: Run roundtrip tests" | ||
if: ${{ runner.os != 'Windows' }} | ||
|
@@ -423,8 +429,8 @@ jobs: | |
if: matrix.upload_binaries | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: binaries-${{ env.artifact_dir_name }} | ||
path: ${{ env.artifact_dir_name }} | ||
name: binaries-${{ matrix.node-target }} | ||
path: packages/@rescript/${{ matrix.node-target }}/bin | ||
|
||
- name: "Upload artifacts: lib/ocaml" | ||
if: matrix.upload_libs | ||
|
@@ -438,7 +444,7 @@ jobs: | |
- build-compiler | ||
- build-rewatch | ||
|
||
runs-on: ubuntu-24.04 | ||
runs-on: ubuntu-24.04-arm | ||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -447,29 +453,22 @@ jobs: | |
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: yarn | ||
node-version-file: .nvmrc | ||
|
||
- name: NPM install | ||
run: yarn install | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: "@(binaries-*|rewatch-*|lib-ocaml)" | ||
|
||
- name: Move artifacts | ||
run: ./scripts/moveArtifacts.sh | ||
- name: Move artifacts into packages | ||
run: .github/workflows/moveArtifacts.sh | ||
shell: bash | ||
|
||
- name: npm pack (rescript) + check artifact list | ||
- name: Check artifact list | ||
run: node ./scripts/npmPack.js | ||
|
||
- 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: yarn pack @rescript/* subpackages | ||
run: yarn workspaces foreach -W --no-private --exclude rescript pack | ||
|
||
- name: Prepare package upload | ||
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit. | ||
|
@@ -482,6 +481,11 @@ jobs: | |
path: | | ||
rescript-${{ env.rescript_version }}.tgz | ||
rescript-std-${{ env.rescript_version }}.tgz | ||
rescript-linux-x64-${{ env.rescript_version }}.tgz | ||
rescript-linux-arm64-${{ env.rescript_version }}.tgz | ||
rescript-darwin-x64-${{ env.rescript_version }}.tgz | ||
rescript-darwin-arm64-${{ env.rescript_version }}.tgz | ||
rescript-win32-x64-${{ env.rescript_version }}.tgz | ||
|
||
outputs: | ||
rescript_version: ${{ env.rescript_version }} | ||
|
@@ -491,15 +495,19 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ | ||
macos-13, # x64 | ||
macos-14, # ARM | ||
ubuntu-24.04, | ||
ubuntu-24.04-arm, | ||
windows-latest, | ||
] | ||
include: | ||
- os: macos-13 | ||
node-target: darwin-x64 | ||
- os: macos-14 | ||
node-target: darwin-arm64 | ||
- os: ubuntu-24.04 | ||
node-target: linux-x64 | ||
- os: ubuntu-24.04-arm | ||
node-target: linux-arm64 | ||
- os: windows-latest | ||
node-target: win32-x64 | ||
|
||
runs-on: ${{matrix.os}} | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -532,7 +540,8 @@ jobs: | |
- name: Install ReScript package | ||
run: | | ||
npm i --ignore-scripts --no-audit \ | ||
rescript-${{ needs.package.outputs.rescript_version }}.tgz | ||
rescript-${{ needs.package.outputs.rescript_version }}.tgz \ | ||
rescript-${{ matrix.node-target }}-${{ needs.package.outputs.rescript_version }}.tgz | ||
shell: bash | ||
working-directory: ${{ steps.tmp-dir.outputs.path }} | ||
|
||
|
@@ -546,7 +555,7 @@ jobs: | |
|
||
if: startsWith(github.ref, 'refs/tags/v') | ||
|
||
runs-on: ubuntu-24.04 | ||
runs-on: ubuntu-24.04-arm | ||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -568,8 +577,13 @@ jobs: | |
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 | ||
npm publish --tag ci rescript-${{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-std-${{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-linux-x64-${{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-linux-arm64-${{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-darwin-x64-${{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-darwin-arm64-{{ needs.package.outputs.rescript_version }}.tgz | ||
npm publish --tag ci rescript-win32-x64-${{ needs.package.outputs.rescript_version }}.tgz | ||
|
||
- name: Update Website Playground | ||
env: | ||
|
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,6 @@ _build | |
node_modules | ||
*.dump | ||
coverage | ||
*.exe | ||
|
||
.ninja_log | ||
.bsdeps | ||
|
@@ -82,6 +81,12 @@ tests/tools_tests/lib | |
tests/analysis_tests*/lib | ||
tests/analysis_tests/**/*.bs.js | ||
|
||
/linux/*.exe | ||
/linuxarm64/*.exe | ||
/darwin/*.exe | ||
/darwinarm64/*.exe | ||
/win32/*.exe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need to add these if we ignore all *.exe (further below)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused lines, I will remove |
||
|
||
.yarn/* | ||
!.yarn/patches | ||
!.yarn/plugins | ||
|
@@ -90,3 +95,7 @@ tests/analysis_tests/**/*.bs.js | |
!.yarn/versions | ||
|
||
*.tsbuildinfo | ||
|
||
# package tarballs | ||
package.tgz | ||
*.exe |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to use GitHub's package registry for nightly builds