Skip to content

ci: Do Windows build but do not run tests #291

ci: Do Windows build but do not run tests

ci: Do Windows build but do not run tests #291

Workflow file for this run

name: build
on: push
jobs:
build:
runs-on: >-
${{
((matrix.os == 'linux' && matrix.arch == 'arm64') &&
'ubuntu-22.04-arm' ||
((matrix.os == 'mac' && matrix.arch == 'arm64') &&
'macos-15' ||
(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, win]
arch: [arm64, x64]
exclude:
- os: win
arch: arm64
steps:
- name: Install linux dependencies
if: matrix.os == 'linux'
run: sudo apt-get install -y ninja-build libblas-dev liblapack-dev liblapacke-dev
- name: Install mac dependencies
if: matrix.os == 'mac'
run: brew install ninja openblas
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Install node modules
run: yarn
- name: Use ccache
uses: hendrikmuhs/[email protected]
with:
key: ccache-${{ matrix.os }}-${{ matrix.arch }}
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v2
id: cpu-cores
- name: Build (Posix)
if: matrix.os != 'win'
run: |
yarn build -p ${{ steps.cpu-cores.outputs.count }} \
-G Ninja \
--CDCMAKE_C_COMPILER_LAUNCHER=ccache \
--CDCMAKE_CXX_COMPILER_LAUNCHER=ccache
- name: Build (Windows)
if: matrix.os == 'win'
shell: cmd
run: |
yarn build -p ${{ steps.cpu-cores.outputs.count }} ^
--CDCMAKE_BUILD_TYPE=Release
- name: Test
if: matrix.os != 'win'
run: yarn test
- name: Prepare .node file
run: cp build/Release/mlx.node mlx-${{ matrix.os }}-${{ matrix.arch }}.node
- name: Prepare .metallib file
if: matrix.os == 'mac' && matrix.arch == 'arm64'
run: cp build/deps/mlx/mlx/backend/metal/kernels/mlx.metallib mlx-${{ matrix.os }}-${{ matrix.arch }}.metallib
- name: Upload Binary Files
uses: actions/upload-artifact@v4
with:
name: mlx-${{ matrix.os }}-${{ matrix.arch }}
path: mlx-${{ matrix.os }}-${{ matrix.arch }}.*
retention-days: 1
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
runs-on: ubuntu-latest
permissions:
# Needed by action-gh-release.
contents: write
steps:
- name: Download Files
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Compress files
run: gzip *
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
name: node-mlx ${{ github.ref_name }}
body: '## Changelog'
files: '*.gz'