Skip to content

Commit 020b3ee

Browse files
committed
new github workflows
1 parent d0b70ca commit 020b3ee

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: BAML Release - Build Typescript AArch64 GLIBC
2+
3+
on:
4+
workflow_call: {}
5+
workflow_dispatch: {}
6+
push:
7+
branches:
8+
- sam/ts-release
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: aarch64-unknown-linux-gnu
30+
# Do not use -latest, since it uses a different glibc version!
31+
host: ubuntu-22.04-arm
32+
# Use manylinux2014 aarch64 container to target older glibc (<2.33)
33+
container: quay.io/pypa/manylinux2014_aarch64
34+
node_build: pnpm build:napi-release --target aarch64-unknown-linux-gnu
35+
cargo_args: -p baml-typescript-ffi -p baml-python-ffi
36+
37+
name: ${{ matrix._.target }}
38+
runs-on: ${{ matrix._.host }}
39+
env:
40+
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
# Check GLIBC version for Linux targets (skip musl targets)
46+
- name: Check GLIBC version
47+
if: contains(matrix._.target, 'linux') && !contains(matrix._.target, 'musl')
48+
run: |
49+
ldd --version
50+
51+
- name: Check GLIBC version (manylinux_2_24 aarch64 container)
52+
run: |
53+
docker run --rm --platform=linux/arm64 quay.io/pypa/manylinux_2_24_aarch64 ldd --version
54+
55+
- name: Build inside manylinux_2_24 (aarch64)
56+
env:
57+
TARGET: ${{ matrix._.target }}
58+
run: |
59+
set -euo pipefail
60+
docker run --rm --platform=linux/arm64 \
61+
-e TARGET="$TARGET" \
62+
-e TURBO_TOKEN="${TURBO_TOKEN:-}" \
63+
-e TURBO_TEAM="${TURBO_TEAM:-}" \
64+
-v "$PWD":/work \
65+
-w /work \
66+
quay.io/pypa/manylinux_2_24_aarch64 \
67+
bash -lc '
68+
set -euo pipefail
69+
echo "--- GLIBC in container ---"
70+
ldd --version
71+
72+
echo "--- Install prerequisites ---"
73+
apt-get update -y
74+
apt-get install -y curl git xz-utils build-essential python3 pkg-config ca-certificates
75+
update-ca-certificates
76+
77+
echo "--- Install Rust toolchain ---"
78+
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89.0
79+
source "$HOME/.cargo/env"
80+
rustup target add "$TARGET"
81+
82+
echo "--- Build Node.js from source (targets glibc 2.24) and install pnpm ---"
83+
NODE_VERSION=20.17.0
84+
curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.tar.gz" | tar -xz
85+
cd node-v${NODE_VERSION}
86+
./configure --prefix=/opt/node
87+
make -j"$(nproc)"
88+
make install
89+
export PATH=/opt/node/bin:$PATH
90+
node -v
91+
npm install -g pnpm@9.12.0
92+
cd /work
93+
94+
echo "--- Install project dependencies ---"
95+
cd engine/language_client_typescript
96+
pnpm install --frozen-lockfile
97+
98+
echo "--- Build NAPI ---"
99+
pnpm build:napi-release --target "$TARGET"
100+
101+
echo "--- Build TS ---"
102+
pnpm build:ts_build
103+
104+
echo "--- Verify produced binaries ---"
105+
ls -l *.node
106+
ldd *.node
107+
'
108+
109+
- name: Upload artifact
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: bindings-${{ matrix._.target }}
113+
path: engine/language_client_typescript/*.node
114+
if-no-files-found: error

0 commit comments

Comments
 (0)