-
Notifications
You must be signed in to change notification settings - Fork 167
217 lines (187 loc) · 7.19 KB
/
node-builds.yml
File metadata and controls
217 lines (187 loc) · 7.19 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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
name: Node FFI binding build and release
permissions:
id-token: write # Required for OIDC
contents: write # Required to create GH releases
on:
workflow_dispatch:
inputs:
dry_run:
description: "Dry run: build artifacts but skip npm publish."
required: false
type: boolean
default: false
workflow_call:
inputs:
dry_run:
description: "Dry run: build artifacts but skip npm publish."
required: false
type: boolean
default: false
env:
CARGO_TERM_COLOR: always
APP_NAME: rtc-node
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-15-large
platform: macos
target: x86_64-apple-darwin
macosx_deployment_target: "10.15"
- os: macos-15
platform: macos
target: aarch64-apple-darwin
macosx_deployment_target: "11.0"
- os: windows-latest
platform: windows
target: x86_64-pc-windows-msvc
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
build_image: sameli/manylinux_2_28_x86_64_cuda_12.3
- os: ubuntu-24.04-arm
platform: linux
target: aarch64-unknown-linux-gnu
build_image: quay.io/pypa/manylinux_2_28_aarch64
name: stable - ${{ matrix.target }} - node@20
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
with:
package_json_file: livekit-ffi-node-bindings/package.json
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: livekit-ffi-node-bindings/pnpm-lock.yaml
- run: pnpm install
working-directory: livekit-ffi-node-bindings
- uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: stable
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
- name: Install Protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0
with:
version: "25.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build (Linux)
if: ${{ matrix.platform == 'linux' }}
run: |
PROTOC_PATH=$(which protoc)
HOST_UID=$(id -u)
HOST_GID=$(id -g)
docker run --rm \
-e HOST_UID=$HOST_UID \
-e HOST_GID=$HOST_GID \
-e TARGET=${{ matrix.target }} \
-v $PWD:/workspace \
-v $PROTOC_PATH:/tmp/protoc:ro \
-w /workspace \
${{ matrix.build_image }} \
bash -lc '
set -euo pipefail
uname -a
cp /tmp/protoc /usr/local/bin/protoc
chmod +x /usr/local/bin/protoc
yum install -y openssl-devel libX11-devel mesa-libGL-devel libXext-devel libva-devel libdrm-devel clang clang-devel lld
yum install -y gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-libstdc++-devel libstdc++-devel
source /opt/rh/gcc-toolset-12/enable
gcc --version
g++ --version
clang --version
clang++ --version
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
yum install -y nodejs --setopt=nodesource-nodejs.module_hotfixes=1
npm install --global pnpm
groupadd -g "$HOST_GID" hostgroup 2>/dev/null || true
useradd -m -u "$HOST_UID" -g "$HOST_GID" hostuser 2>/dev/null || true
su - hostuser -c "
set -euo pipefail
export RUST_BACKTRACE=full
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
export PATH=\$HOME/.cargo/bin:\$PATH
source /opt/rh/gcc-toolset-12/enable
export CC=clang
export CXX=clang++
TOOLCHAIN_ROOT=/opt/rh/gcc-toolset-12/root/usr
export CFLAGS=\"--gcc-toolchain=\$TOOLCHAIN_ROOT\"
export CXXFLAGS=\"--gcc-toolchain=\$TOOLCHAIN_ROOT\"
cd /workspace
cd livekit-ffi-node-bindings
CI=true pnpm install
pnpm build --target $TARGET
"
'
- name: Build (macOS)
if: ${{ matrix.platform == 'macos' }}
working-directory: livekit-ffi-node-bindings
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
run: pnpm build --target ${{ matrix.target }}
- name: Build (Windows)
if: ${{ matrix.platform == 'windows' }}
working-directory: livekit-ffi-node-bindings
run: pnpm build --target ${{ matrix.target }}
- name: Upload binary artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: native-bindings-${{ matrix.target }}
path: livekit-ffi-node-bindings/${{ env.APP_NAME }}.*.node
if-no-files-found: error
- name: Upload JS
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: ${{ matrix.os == 'macos-15' }}
with:
name: js-bindings
path: livekit-ffi-node-bindings/native.*
if-no-files-found: error
publish:
needs: build
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4.3.0
with:
package_json_file: livekit-ffi-node-bindings/package.json
- name: Setup node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
cache: pnpm
cache-dependency-path: livekit-ffi-node-bindings/pnpm-lock.yaml
- working-directory: livekit-ffi-node-bindings
run: pnpm install
- name: Download native build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: native-bindings-*
path: livekit-ffi-node-bindings/artifacts
- name: Download js artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: js-bindings
path: livekit-ffi-node-bindings
- name: Move artifacts
run: pnpm run ci:artifacts
working-directory: livekit-ffi-node-bindings
- name: List packages
run: ls -R ./livekit-ffi-node-bindings/npm
shell: bash
- name: Echo changes
run: |
git status
git diff
- name: Publish
working-directory: livekit-ffi-node-bindings
run: pnpm publish -r ${{ inputs.dry_run == true && '--dry-run --no-git-checks' || '' }}