-
Notifications
You must be signed in to change notification settings - Fork 6
59 lines (48 loc) · 1.8 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: build
on: push
jobs:
build:
runs-on: >-
${{
(matrix.os == 'mac' && matrix.arch == 'arm64') &&
'macos-14' ||
(fromJson('{"linux":"ubuntu-22.04","mac":"macos-13","win":"windows-2022"}')[matrix.os])
}}
continue-on-error: false
strategy:
fail-fast: false
matrix:
os: [linux, mac]
arch: [arm64, x64]
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
- name: Install mac dependencies
if: matrix.os == 'mac' && matrix.arch == 'x64'
run: brew install openblas
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Build (native)
if: matrix.os != 'linux' || matrix.arch == runner.arch
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:
platform: 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: yarn && yarn build -p ${{ steps.cpu-cores.outputs.count }} && yarn test