Skip to content
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

Build linux-arm64 executable on CI #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
96 changes: 89 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
os: [ubuntu-latest]
ocaml-version: [4.14.1]
node-version: [16.x]
container:
image: ocaml/opam:ubuntu-20.04-ocaml-4.14
options: --user root

steps:
- name: Checkout repo
Expand All @@ -27,6 +30,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install Yarn
run: npm install -g yarn

- name: Print Yarn cache
id: print-yarn-cache
run: echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand All @@ -42,12 +48,13 @@ jobs:
run: yarn install

- name: Setup OCaml ${{ matrix.ocaml-version }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-version }}
# uses: ocaml/setup-ocaml@v2
# with:
# ocaml-compiler: ${{ matrix.ocaml-version }}
run: opam init -a --disable-sandboxing --compiler=4.14.1

- name: Install Opam deps
run: opam install . --deps-only --with-test
run: opam install . --deps-only --with-test --yes

- name: Build PPX
run: opam exec -- dune build
Expand Down Expand Up @@ -182,6 +189,73 @@ jobs:
name: ${{ matrix.container-os }}
path: _build/default/ppx/bin/bin.exe

build_linux_arm:
name: Build on ${{ matrix.container-os }}
runs-on: ${{ matrix.host-os }}
if: startsWith(github.ref, 'refs/tags/v')
needs:
- validate
strategy:
matrix:
host-os: [ubuntu-24.04-arm]
container-os: [linux-arm]
ocaml-version: [4.14.1]
node-version: [16.x]
container:
image: ocaml/opam:ubuntu-20.04-ocaml-4.14
options: --user root

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install Node 16.x
uses: actions/setup-node@v4
with:
node-version: 16.x

- name: Install Yarn
run: npm install -g yarn

- name: Print Yarn cache
id: print-yarn-cache
run: echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Restore Yarn cache
id: yarn-cache
uses: actions/cache@v4
with:
path: ${{ steps.print-yarn-cache.outputs.yarn-cache }}
key: ${{ matrix.container-os }}-yarn-${{ hashFiles('yarn.lock', '*/yarn.lock') }}

- name: Install Yarn deps
run: yarn install

- name: Setup OCaml ${{ matrix.ocaml-version }}
run: opam init -a --disable-sandboxing --compiler=${{ matrix.ocaml-version }}

- name: Install Opam deps
run: opam install . --deps-only --with-test

- name: Build PPX
run: opam exec -- dune build --profile static

- name: Build ReScript lib
run: |
cd lib
yarn run build

- name: Build ReScript examples
run: |
cd examples
yarn run build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.container-os }}
path: _build/default/ppx/bin/bin.exe

build_windows:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -263,6 +337,7 @@ jobs:
needs:
- build_macos
- build_linux
- build_linux_arm
- build_windows
name: Release
runs-on: ubuntu-latest
Expand Down Expand Up @@ -290,11 +365,17 @@ jobs:
name: macos-14
path: _bin/darwin/arm

- name: Download Linux artifacts
- name: Download Linux x86 artifacts
uses: actions/download-artifact@v4
with:
name: linux-alpine-3
path: _bin/linux
path: _bin/linux/intel

- name: Download Linux ARM artifacts
uses: actions/download-artifact@v4
with:
name: linux-arm
path: _bin/linux/arm

- name: Download Windows artifacts
uses: actions/download-artifact@v4
Expand All @@ -307,7 +388,8 @@ jobs:
mkdir -p _release/bin
mv _bin/darwin/intel/bin.exe _release/bin/rescript-logger-ppx-darwin-x64.exe
mv _bin/darwin/arm/bin.exe _release/bin/rescript-logger-ppx-darwin-arm64.exe
mv _bin/linux/bin.exe _release/bin/rescript-logger-ppx-linux-x64.exe
mv _bin/linux/intel/bin.exe _release/bin/rescript-logger-ppx-linux-x64.exe
mv _bin/linux/arm/bin.exe _release/bin/rescript-logger-ppx-linux-arm64.exe
mv _bin/windows/bin.exe _release/bin/rescript-logger-ppx-win-x64.exe
rm -rf _bin

Expand Down