Skip to content

Commit 75f9a9d

Browse files
committed
upload platform artifacts
1 parent 956f466 commit 75f9a9d

File tree

4 files changed

+79
-42
lines changed

4 files changed

+79
-42
lines changed

Diff for: .github/workflows/ci.yml

+33-26
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ jobs:
438438
- build-compiler
439439
- build-rewatch
440440

441-
runs-on: ubuntu-24.04
441+
runs-on: ubuntu-24.04-arm
442442

443443
steps:
444444
- name: Checkout
@@ -447,29 +447,21 @@ jobs:
447447
- name: Use Node.js
448448
uses: actions/setup-node@v4
449449
with:
450-
cache: yarn
451450
node-version-file: .nvmrc
452451

453-
- name: NPM install
454-
run: yarn install
455-
456452
- name: Download artifacts
457453
uses: actions/download-artifact@v4
458454
with:
459455
pattern: "@(binaries-*|rewatch-*|lib-ocaml)"
460456

461-
- name: Move artifacts
462-
run: ./scripts/moveArtifacts.sh
457+
- name: Move artifacts into packages
458+
run: .github/workflows/moveArtifacts.sh
463459

464-
- name: npm pack (rescript) + check artifact list
460+
- name: Check artifact list
465461
run: node ./scripts/npmPack.js
466462

467-
- name: Copy JS files to stdlib package
468-
run: mkdir -p packages/std/lib && cp -R lib/es6 lib/js packages/std/lib
469-
470-
- name: npm pack (@rescript/std)
471-
run: npm pack
472-
working-directory: packages/std
463+
- name: yarn pack @rescript/* subpackages
464+
run: yarn workspaces foreach -W --no-private --exclude rescript pack
473465

474466
- name: Prepare package upload
475467
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
@@ -482,6 +474,11 @@ jobs:
482474
path: |
483475
rescript-${{ env.rescript_version }}.tgz
484476
rescript-std-${{ env.rescript_version }}.tgz
477+
rescript-linux-x64-${{ env.rescript_version }}.tgz
478+
rescript-linux-arm64-${{ env.rescript_version }}.tgz
479+
rescript-darwin-x64-${{ env.rescript_version }}.tgz
480+
rescript-darwin-arm64-${{ env.rescript_version }}.tgz
481+
rescript-win32-x64-${{ env.rescript_version }}.tgz
485482
486483
outputs:
487484
rescript_version: ${{ env.rescript_version }}
@@ -491,15 +488,19 @@ jobs:
491488
strategy:
492489
fail-fast: false
493490
matrix:
494-
os: [
495-
macos-13, # x64
496-
macos-14, # ARM
497-
ubuntu-24.04,
498-
ubuntu-24.04-arm,
499-
windows-latest,
500-
]
491+
include:
492+
- os: macos-13 # x64
493+
target: darwin-x64
494+
- os: macos-14 # ARM
495+
target: darwin-arm64
496+
- os: ubuntu-24.04
497+
target: linux-x64
498+
- os: ubuntu-24.04-arm
499+
target: linux-arm64
500+
- os: windows-latest
501+
target: win32-x64
501502

502-
runs-on: ${{matrix.os}}
503+
runs-on: ${{ matrix.os }}
503504

504505
steps:
505506
- name: Checkout
@@ -532,7 +533,8 @@ jobs:
532533
- name: Install ReScript package
533534
run: |
534535
npm i --ignore-scripts --no-audit \
535-
rescript-${{ needs.package.outputs.rescript_version }}.tgz
536+
rescript-${{ needs.package.outputs.rescript_version }}.tgz \
537+
rescript-${{ matrix.target }}-${{ env.rescript_version }}.tgz
536538
shell: bash
537539
working-directory: ${{ steps.tmp-dir.outputs.path }}
538540

@@ -546,7 +548,7 @@ jobs:
546548

547549
if: startsWith(github.ref, 'refs/tags/v')
548550

549-
runs-on: ubuntu-24.04
551+
runs-on: ubuntu-24.04-arm
550552

551553
steps:
552554
- name: Checkout
@@ -568,8 +570,13 @@ jobs:
568570
env:
569571
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
570572
run: |
571-
npm publish rescript-${{ needs.package.outputs.rescript_version }}.tgz --tag ci
572-
npm publish rescript-std-${{ needs.package.outputs.rescript_version }}.tgz --tag ci
573+
npm publish --tag ci rescript-${{ needs.package.outputs.rescript_version }}.tgz
574+
npm publish --tag ci rescript-std-${{ needs.package.outputs.rescript_version }}.tgz
575+
npm publish --tag ci rescript-linux-x64-${{ needs.package.outputs.rescript_version }}.tgz
576+
npm publish --tag ci rescript-linux-arm64-${{ needs.package.outputs.rescript_version }}.tgz
577+
npm publish --tag ci rescript-darwin-x64-${{ needs.package.outputs.rescript_version }}.tgz
578+
npm publish --tag ci rescript-darwin-arm64-{{ needs.package.outputs.rescript_version }}.tgz
579+
npm publish --tag ci rescript-win32-x64-${{ needs.package.outputs.rescript_version }}.tgz
573580
574581
- name: Update Website Playground
575582
env:

Diff for: scripts/moveArtifacts.sh renamed to .github/workflows/moveArtifacts.sh

+16-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
2+
23
set -e
34

45
check_statically_linked() {
@@ -24,18 +25,19 @@ check_statically_linked() {
2425
fi
2526
}
2627

27-
chmod +x binaries-*/*.exe rewatch-*/*.exe
28-
29-
mkdir darwin darwinarm64 linux linuxarm64 win32
30-
31-
mv binaries-darwin/* rewatch-darwin/* darwin
32-
mv binaries-darwinarm64/* rewatch-darwinarm64/* darwinarm64
33-
mv binaries-linux/* rewatch-linux/* linux
34-
mv binaries-linuxarm64/* rewatch-linuxarm64/* linuxarm64
35-
mv binaries-win32/* rewatch-win32/* win32
36-
28+
# rescript
3729
mv lib-ocaml lib/ocaml
38-
mv ninja/COPYING ninja.COPYING
3930

40-
check_statically_linked "linux"
41-
check_statically_linked "linuxarm64"
31+
# @rescript/{target}
32+
chmod +x binaries-*/*.exe rewatch-*/*.exe
33+
mv -f binaries-darwin/* rewatch-darwin/* packages/@rescript/darwin-x64/bin
34+
mv -f binaries-darwinarm64/* rewatch-darwinarm64/* packages/@rescript/darwin-arm64/bin
35+
mv -f binaries-linux/* rewatch-linux/* packages/@rescript/linux-x64/bin
36+
mv -f binaries-linuxarm64/* rewatch-linuxarm64/* packages/@rescript/linux-arm64/bin
37+
mv -f binaries-win32/* rewatch-win32/* packages/@rescript/win32-x64/bin
38+
check_statically_linked "packages/@rescript/linux-x64/bin"
39+
check_statically_linked "packages/@rescript/linux-arm64/bin"
40+
41+
# @rescript/std
42+
mkdir -p packages/std/lib
43+
cp -R lib/es6 lib/js packages/std/lib

Diff for: .github/workflows/prepare_package_upload.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,40 @@ const { version } = packageSpec;
1010
const commitHash = process.argv[2] || process.env.GITHUB_SHA;
1111
const commitHashShort = commitHash.substring(0, 7);
1212

13+
// rescript
1314
fs.renameSync(
14-
`rescript-${version}.tgz`,
15+
"package.tgz",
1516
`rescript-${version}-${commitHashShort}.tgz`,
1617
);
18+
19+
// @rescript/std
1720
fs.renameSync(
18-
`packages/std/rescript-std-${version}.tgz`,
21+
"packages/@rescript/std/package.tgz",
1922
`rescript-std-${version}-${commitHashShort}.tgz`,
2023
);
2124

25+
// @rescript/{target}
26+
fs.renameSync(
27+
"packages/@rescript/linux-x64/package.tgz",
28+
`rescript-linux-x64-${version}-${commitHashShort}.tgz`,
29+
);
30+
fs.renameSync(
31+
"packages/@rescript/linux-arm64/package.tgz",
32+
`rescript-linux-arm64-${version}-${commitHashShort}.tgz`,
33+
);
34+
fs.renameSync(
35+
"packages/@rescript/darwin-x64/package.tgz",
36+
`rescript-darwin-x64-${version}-${commitHashShort}.tgz`,
37+
);
38+
fs.renameSync(
39+
"packages/@rescript/darwin-arm64/package.tgz",
40+
`rescript-darwin-arm64-${version}-${commitHashShort}.tgz`,
41+
);
42+
fs.renameSync(
43+
"packages/@rescript/win32-x64/package.tgz",
44+
`rescript-win32-x64-${version}-${commitHashShort}.tgz`,
45+
);
46+
2247
// Pass information to subsequent GitHub actions
2348
fs.appendFileSync(
2449
process.env.GITHUB_ENV,

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@ tests/analysis_tests/**/*.bs.js
9595
!.yarn/versions
9696

9797
*.tsbuildinfo
98+
99+
# package tarballs
100+
package.tgz

0 commit comments

Comments
 (0)