Skip to content

Commit

Permalink
ci: Use native linux arm64 builder
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Jan 17, 2025
1 parent d39682b commit 128870e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
37 changes: 10 additions & 27 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@ jobs:
build:
runs-on: >-
${{
(matrix.os == 'mac' && matrix.arch == 'arm64') &&
((matrix.os == 'linux' && matrix.arch == 'arm64') &&
'ubuntu-24.04-arm' ||
((matrix.os == 'mac' && matrix.arch == 'arm64') &&
'macos-15' ||
(fromJson('{"linux":"ubuntu-22.04","mac":"macos-13","win":"windows-2022"}')[matrix.os])
(fromJson('{"linux":"ubuntu-24.04","mac":"macos-13","win":"windows-2022"}')[matrix.os])))
}}
continue-on-error: false

strategy:
fail-fast: false
matrix:
os: [linux, mac]
os: [linux, mac, win]
arch: [arm64, x64]
exclude:
- os: win
arch: arm64

steps:
- name: Install linux dependencies
if: matrix.os == 'linux' && matrix.arch == runner.arch
run: sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev
if: matrix.os == 'linux'
run: |
npm install -g yarn
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev
- name: Install mac dependencies
if: matrix.os == 'mac' && matrix.arch == 'x64'
Expand All @@ -39,30 +43,9 @@ jobs:
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores

- name: Build (native)
if: matrix.os != 'linux' || matrix.arch == runner.arch
- name: Build
run: yarn && yarn build -p ${{ steps.cpu-cores.outputs.count }} && yarn test

- name: Set up QEMU
if: matrix.os == 'linux' && matrix.arch != runner.arch
uses: docker/setup-qemu-action@v3
with:
platforms: matrix.arch

- name: Enable multi-arch containers in QEMU
if: matrix.os == 'linux' && matrix.arch != runner.arch
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

- name: Build (docker)
if: matrix.os == 'linux' && matrix.arch != runner.arch
uses: addnab/docker-run-action@v3
with:
image: zcbenz/node-mlx:main
options: --platform=linux/${{ matrix.arch }} -v ${{ github.workspace }}:/build -w /build
run: |
export CI=true
yarn && yarn build -p ${{ steps.cpu-cores.outputs.count }} && yarn test
- name: Prepare .node file
run: cp build/Release/mlx.node mlx-${{ matrix.os }}-${{ matrix.arch }}.node

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/post-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
post-release:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04

steps:
- name: Checkout
Expand All @@ -22,6 +22,7 @@ jobs:
- name: Install deps
run: |
sudo apt-get install -y libblas-dev liblapack-dev liblapacke-dev
yarn
yarn prepack
yarn test
Expand Down

0 comments on commit 128870e

Please sign in to comment.