-
Notifications
You must be signed in to change notification settings - Fork 425
Expand file tree
/
Copy pathbuild-typescript-release.reusable.yaml
More file actions
146 lines (125 loc) · 5.32 KB
/
build-typescript-release.reusable.yaml
File metadata and controls
146 lines (125 loc) · 5.32 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: BAML Release - Build Typescript
on:
workflow_call: {}
push:
branches:
- sam/win-arm64-ts
concurrency:
# suffix is important to prevent a concurrency deadlock with the calling workflow
group: ${{ github.workflow }}-${{ github.ref }}-build-typescript
cancel-in-progress: true
env:
DEBUG: napi:*
APP_NAME: baml
MACOSX_DEPLOYMENT_TARGET: "10.13"
# Turbo remote caching
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: gloo
jobs:
build:
strategy:
fail-fast: false
matrix:
_:
- target: aarch64-unknown-linux-gnu
host: ubuntu-24.04-arm
# Target glibc 2.17. This is the oldest glibc we can practically support.
# Note that ubuntu-22.04-arm has glibc 2.35, but our users need older glibc.
# See https://github.com/BoundaryML/baml/issues/2736
container: ghcr.io/rust-cross/manylinux_2_28-cross:aarch64
before: |
echo "CFLAGS_aarch64_unknown_linux_gnu=-D__ARM_ARCH=8" >> "$GITHUB_ENV"
node_build: pnpm build:napi-release --target aarch64-unknown-linux-gnu
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
skip_protoc: true
- target: aarch64-apple-darwin
host: macos-14
node_build: pnpm build:napi-release --target aarch64-apple-darwin
- target: x86_64-apple-darwin
host: macos-14
node_build: pnpm build:napi-release --target x86_64-apple-darwin
- target: x86_64-pc-windows-msvc
host: windows-latest
node_build: pnpm build:napi-release --target x86_64-pc-windows-msvc
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
- target: aarch64-pc-windows-msvc
host: windows-11-arm
architecture: arm64
node_build: pnpm build:napi-release --target aarch64-pc-windows-msvc
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
- target: x86_64-unknown-linux-gnu
# Do not use -latest, since it uses a newer glibc version!
host: ubuntu-22.04
node_build: pnpm build:napi-release --target x86_64-unknown-linux-gnu --use-napi-cross
- target: x86_64-unknown-linux-musl
host: ubuntu-22.04
# muslcc url needs to change eventually. https://github.com/elixir-sqlite/exqlite/issues/327
before: |
curl -LO https://musl.cc.timfish.dev/x86_64-linux-musl-cross.tgz
tar -xzf x86_64-linux-musl-cross.tgz
echo "$PWD/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH
cat >>$GITHUB_ENV <<EOF
CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc
CXX_x86_64_unknown_linux_musl=x86_64-linux-musl-g++
AR_x86_64_unknown_linux_musl=x86_64-linux-musl-ar
RUSTFLAGS=-C target-feature=-crt-static --cfg tracing_unstable
EOF
node_build: pnpm build:napi-release --target x86_64-unknown-linux-musl -x
setup_zig: true
- target: aarch64-unknown-linux-musl
host: ubuntu-22.04
# muslcc url needs to change eventually. https://github.com/elixir-sqlite/exqlite/issues/327
before: |
curl -LO https://musl.cc.timfish.dev/aarch64-linux-musl-cross.tgz
tar -xzf aarch64-linux-musl-cross.tgz
echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
cat >>$GITHUB_ENV <<EOF
RUSTFLAGS=-C target-feature=-crt-static --cfg tracing_unstable
EOF
node_build: pnpm build:napi-release --target aarch64-unknown-linux-musl --use-napi-cross
name: ${{ matrix._.target }}
runs-on: ${{ matrix._.host }}
container: ${{ matrix._.container }}
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
steps:
- name: Checkout
uses: actions/checkout@v6
# Check GLIBC version for Linux targets (skip musl targets)
- name: Check GLIBC version
if: contains(matrix._.target, 'linux') && !contains(matrix._.target, 'musl')
run: |
ldd --version
# Setup using standardized actions
- name: Setup Node.js
uses: ./.github/actions/setup-node
with:
node-action-version: v6
- name: Setup Rust
uses: ./.github/actions/setup-rust
with:
targets: ${{ matrix._.target }}
prefix-key: v5-rust-${{ matrix._.target }}
cache-on-failure: true
skip-protoc: ${{ matrix._.skip_protoc || 'false' }}
# Setup Zig for targets that need it (e.g. musl cross-compilation)
- name: Setup Zig
if: matrix._.setup_zig
uses: mlugg/setup-zig@v2
# per-matrix-entry dependency setup
- name: Build tools setup
if: matrix._.before
run: ${{ matrix._.before }}
# Build the NAPI library and bindings
- name: PNPM Build
run: ${{ matrix._.node_build }}
working-directory: engine/language_client_typescript
- name: Build TS
run: pnpm build:ts_build
working-directory: engine/language_client_typescript
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: bindings-${{ matrix._.target }}
path: engine/language_client_typescript/*.node
if-no-files-found: error