Skip to content

Commit a8cd564

Browse files
committed
Add Windows ARM64 TypeScript build workflow
1 parent 92f492c commit a8cd564

4 files changed

Lines changed: 133 additions & 5 deletions

File tree

.github/actions/setup-node/action.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ inputs:
2929
npm-token:
3030
description: 'NPM authentication token'
3131
required: false
32+
node-action-version:
33+
description: 'Version of actions/setup-node to use (v4 or v6)'
34+
required: false
35+
# Default to v4 for backwards compatibility.
36+
default: 'v4'
37+
type: choice
38+
options:
39+
- v4
40+
- v6
3241

3342
runs:
3443
using: 'composite'
@@ -48,7 +57,8 @@ runs:
4857
version: ${{ inputs.pnpm-version }}
4958
run_install: false
5059

51-
- name: Setup Node.js
60+
- name: Setup Node.js (v4)
61+
if: inputs.node-action-version == 'v4'
5262
uses: actions/setup-node@v4
5363
with:
5464
node-version: ${{ inputs.node-version }}
@@ -58,7 +68,18 @@ runs:
5868
env:
5969
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
6070

71+
- name: Setup Node.js (v6)
72+
if: inputs.node-action-version == 'v6'
73+
uses: actions/setup-node@v6
74+
with:
75+
node-version: ${{ inputs.node-version }}
76+
cache: pnpm
77+
cache-dependency-path: pnpm-lock.yaml
78+
registry-url: "https://registry.npmjs.org"
79+
env:
80+
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
81+
6182
- name: Install Node dependencies
6283
if: inputs.install-dependencies == 'true'
6384
run: pnpm install ${{ inputs.frozen-lockfile == 'true' && '--frozen-lockfile' || '' }}
64-
shell: bash
85+
shell: bash

.github/actions/setup-rust/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,19 @@ inputs:
4242
runs:
4343
using: "composite"
4444
steps:
45+
- name: Ensure rustup exists on Windows ARM64 runners
46+
shell: bash
47+
run: |
48+
set -euo pipefail
49+
if [[ "${RUNNER_OS:-}" == "Windows" && "${RUNNER_ARCH:-}" =~ [Aa][Rr][Mm]64 ]]; then
50+
if ! command -v rustup >/dev/null 2>&1; then
51+
curl -LO "https://static.rust-lang.org/rustup/dist/aarch64-pc-windows-msvc/rustup-init.exe"
52+
./rustup-init.exe --default-toolchain stable -y
53+
rm rustup-init.exe
54+
echo "$USERPROFILE/.cargo/bin" >> "$GITHUB_PATH"
55+
fi
56+
fi
57+
4558
# - name: Check for mise Rust installation
4659
# id: check-rust
4760
# run: |
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: BAML Release - Build Typescript Windows arm64
2+
3+
on:
4+
workflow_call: {}
5+
workflow_dispatch: {}
6+
push:
7+
branches:
8+
- sam/win-arm64-ts
9+
10+
concurrency:
11+
# suffix is important to prevent a concurrency deadlock with the calling workflow
12+
group: ${{ github.workflow }}-${{ github.ref }}-build-typescript-aarch64
13+
cancel-in-progress: true
14+
15+
env:
16+
DEBUG: napi:*
17+
APP_NAME: baml
18+
MACOSX_DEPLOYMENT_TARGET: "10.13"
19+
# Turbo remote caching
20+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
21+
TURBO_TEAM: gloo
22+
23+
jobs:
24+
build:
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
_:
29+
- target: x86_64-pc-windows-msvc
30+
host: windows-latest
31+
node_build: pnpm build:napi-release --target x86_64-pc-windows-msvc
32+
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
33+
34+
- target: aarch64-pc-windows-msvc
35+
host: windows-11-arm
36+
architecture: arm64
37+
node_action_version: v6
38+
node_build: pnpm build:napi-release --target aarch64-pc-windows-msvc
39+
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
40+
41+
name: ${{ matrix._.target }}
42+
runs-on: ${{ matrix._.host }}
43+
container: ${{ matrix._.container }}
44+
env:
45+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
# Check GLIBC version for Linux targets (skip musl targets)
51+
- name: Check GLIBC version
52+
if: contains(matrix._.target, 'linux') && !contains(matrix._.target, 'musl')
53+
run: |
54+
ldd --version
55+
56+
# Setup using standardized actions
57+
- name: Setup Node.js
58+
uses: ./.github/actions/setup-node
59+
with:
60+
node-action-version: ${{ matrix._.node_action_version }}
61+
62+
- name: Setup Rust
63+
uses: ./.github/actions/setup-rust
64+
with:
65+
targets: ${{ matrix._.target }}
66+
prefix-key: v5-rust-${{ matrix._.target }}
67+
cache-on-failure: true
68+
69+
# per-matrix-entry dependency setup
70+
- name: Build tools setup
71+
if: matrix._.before
72+
run: ${{ matrix._.before }}
73+
74+
# Build the NAPI library and bindings
75+
- name: PNPM Build
76+
run: ${{ matrix._.node_build }}
77+
working-directory: engine/language_client_typescript
78+
79+
- name: Build TS
80+
run: pnpm build:ts_build
81+
working-directory: engine/language_client_typescript
82+
83+
- name: Upload artifact
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: bindings-${{ matrix._.target }}
87+
path: engine/language_client_typescript/*.node
88+
if-no-files-found: error

.github/workflows/build-typescript-release.reusable.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ jobs:
5151
node_build: pnpm build:napi-release --target x86_64-pc-windows-msvc
5252
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
5353

54+
- target: aarch64-pc-windows-msvc
55+
host: windows-11-arm
56+
architecture: arm64
57+
node_action_version: v6
58+
node_build: pnpm build:napi-release --target aarch64-pc-windows-msvc
59+
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
60+
5461
- target: x86_64-unknown-linux-gnu
5562
# Do not use -latest, since it uses a newer glibc version!
5663
host: ubuntu-22.04
@@ -102,6 +109,8 @@ jobs:
102109
# Setup using standardized actions
103110
- name: Setup Node.js
104111
uses: ./.github/actions/setup-node
112+
with:
113+
node-action-version: ${{ matrix._.node_action_version }}
105114

106115
- name: Setup Rust
107116
uses: ./.github/actions/setup-rust
@@ -110,9 +119,6 @@ jobs:
110119
prefix-key: v5-rust-${{ matrix._.target }}
111120
cache-on-failure: true
112121

113-
- name: Setup Go
114-
uses: ./.github/actions/setup-go
115-
116122
# per-matrix-entry dependency setup
117123
- name: Build tools setup
118124
if: matrix._.before

0 commit comments

Comments
 (0)