Skip to content

Commit 9c3d185

Browse files
authored
Update FFI and remove napi (#599)
* remove napi * wip * cleanup * update to latest ffi-bindings * Update FFI bindings and change package dependencies * address comments * update workflow * fix bun tests * remove unused workflow * build before testing * fix workflow * add env vars
1 parent e2c6c6c commit 9c3d185

60 files changed

Lines changed: 217 additions & 21780 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/fresh-lamps-repeat.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/rtc-node": patch
3+
---
4+
5+
Update FFI bindings to latest and import them as a direct dependency

.github/workflows/ci.yml

Lines changed: 12 additions & 191 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ on:
2626
- main
2727

2828
jobs:
29-
check-changes:
30-
name: Check for changes
31-
runs-on: ubuntu-latest
32-
outputs:
33-
rtc_build: ${{ steps.changes.outputs.rtc_build }}
34-
server_sdk_build: ${{ steps.changes.outputs.server_sdk_build }}
35-
steps:
36-
- uses: actions/checkout@v6
37-
- uses: dorny/paths-filter@v3
38-
id: paths
39-
with:
40-
filters: |
41-
livekit-rtc:
42-
- 'packages/livekit-rtc/**'
43-
server-sdk:
44-
- 'packages/livekit-server-sdk/**'
45-
- name: Store change outputs
46-
id: changes
47-
run: |
48-
echo "rtc_build=${{ steps.paths.outputs.livekit-rtc == 'true' || github.ref == 'refs/heads/main' }}" >> $GITHUB_OUTPUT
49-
echo "server_sdk_build=${{ steps.paths.outputs.server-sdk == 'true' || github.ref == 'refs/heads/main' }}" >> $GITHUB_OUTPUT
50-
5129
lint:
5230
name: Formatting
5331
runs-on: ubuntu-latest
@@ -83,182 +61,35 @@ jobs:
8361
steps:
8462
- uses: actions/checkout@v6
8563
- uses: pnpm/action-setup@v4
64+
- uses: oven-sh/setup-bun@v2
8665
- name: Setup Node.js
8766
uses: actions/setup-node@v6
8867
with:
8968
node-version: ${{ matrix.node-version }}
9069
cache: pnpm
9170
- name: Install dependencies
9271
run: pnpm install
93-
# RTC tests will be ran after they are built, because builds are so slow
72+
- name: Test build
73+
run: pnpm --filter="*livekit*" run build
9474
- name: Test livekit-server-sdk (Node)
9575
run: pnpm --filter="livekit-server-sdk" test
9676
- name: Test livekit-server-sdk (Browser)
9777
run: pnpm --filter="livekit-server-sdk" test:browser
9878
- name: Test env livekit-server-sdk (Edge Runtime)
9979
run: pnpm --filter="livekit-server-sdk" test:edge
100-
101-
build:
102-
if: ${{ needs.check-changes.outputs.rtc_build == 'true' }}
103-
strategy:
104-
fail-fast: false
105-
matrix:
106-
include:
107-
- os: macos-15-large
108-
platform: macos
109-
target: x86_64-apple-darwin
110-
macosx_deployment_target: '10.15'
111-
- os: macos-15
112-
platform: macos
113-
target: aarch64-apple-darwin
114-
macosx_deployment_target: '11.0'
115-
- os: windows-latest
116-
platform: windows
117-
target: x86_64-pc-windows-msvc
118-
- os: ubuntu-latest
119-
platform: linux
120-
target: x86_64-unknown-linux-gnu
121-
build_image: sameli/manylinux_2_28_x86_64_cuda_12.3
122-
- os: ubuntu-24.04-arm
123-
platform: linux
124-
target: aarch64-unknown-linux-gnu
125-
build_image: quay.io/pypa/manylinux_2_28_aarch64
126-
127-
name: stable - ${{ matrix.target }} - node@20
128-
runs-on: ${{ matrix.os }}
129-
env:
130-
RUST_BACKTRACE: full
131-
needs: check-changes
132-
steps:
133-
- uses: actions/checkout@v6
134-
with:
135-
submodules: recursive
136-
137-
- uses: pnpm/action-setup@v4
138-
139-
- name: Setup node
140-
uses: actions/setup-node@v6
141-
if: ${{ !matrix.docker }}
142-
with:
143-
node-version: 24
144-
cache: pnpm
145-
146-
- uses: dtolnay/rust-toolchain@stable
147-
with:
148-
toolchain: stable
149-
targets: ${{ matrix.target }}
150-
151-
- name: Install Protoc
152-
uses: arduino/setup-protoc@v3
153-
with:
154-
version: '25.1'
155-
repo-token: ${{ secrets.GITHUB_TOKEN }}
156-
157-
- name: Cache cargo
158-
uses: actions/cache@v4
159-
with:
160-
path: |
161-
~/.cargo/registry/index/
162-
~/.cargo/registry/cache/
163-
~/.cargo/git/db/
164-
packages/livekit-rtc/.cargo-cache
165-
packages/livekit-rtc/target/
166-
key: ${{ matrix.target }}-cargo-${{ matrix.os }}
167-
168-
- name: Install dependencies
169-
run: pnpm install
170-
171-
# on linux, we'll also run tests after building. for the e2e suite, this would
172-
# only run on the main repo, and not forks
173-
- name: Build & test (Linux)
174-
if: ${{ matrix.platform == 'linux' }}
80+
- name: Test rtc-node (Node)
81+
run: pnpm --filter="@livekit/rtc-node" run test
17582
env:
17683
LIVEKIT_URL: ${{ secrets.LIVEKIT_URL }}
17784
LIVEKIT_API_KEY: ${{ secrets.LIVEKIT_API_KEY }}
17885
LIVEKIT_API_SECRET: ${{ secrets.LIVEKIT_API_SECRET }}
179-
run: |
180-
PROTOC_PATH=$(which protoc)
181-
HOST_UID=$(id -u)
182-
HOST_GID=$(id -g)
183-
docker run --rm \
184-
-e HOST_UID=$HOST_UID \
185-
-e HOST_GID=$HOST_GID \
186-
-e TARGET=${{ matrix.target }} \
187-
-v $PWD:/workspace \
188-
-v $PROTOC_PATH:/tmp/protoc:ro \
189-
-w /workspace \
190-
${{ matrix.build_image }} \
191-
bash -lc '
192-
set -euo pipefail
193-
194-
uname -a
195-
cp /tmp/protoc /usr/local/bin/protoc
196-
chmod +x /usr/local/bin/protoc
197-
198-
yum install -y openssl-devel libX11-devel mesa-libGL-devel libXext-devel libva-devel libdrm-devel clang clang-devel
199-
yum install -y gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-libstdc++-devel libstdc++-devel
200-
source /opt/rh/gcc-toolset-12/enable
201-
gcc --version
202-
g++ --version
203-
clang --version
204-
clang++ --version
205-
curl -fsSL https://rpm.nodesource.com/setup_20.x | bash -
206-
yum install -y nodejs --setopt=nodesource-nodejs.module_hotfixes=1
207-
npm install --global pnpm
208-
npm install --global bun
20986

210-
groupadd -g "$HOST_GID" hostgroup 2>/dev/null || true
211-
useradd -m -u "$HOST_UID" -g "$HOST_GID" hostuser 2>/dev/null || true
87+
- name: Test server sdk + rtc-node (Bun)
88+
run: bun install && bun test --concurrent
21289

213-
su - hostuser -c "
214-
set -euo pipefail
215-
export RUST_BACKTRACE=full
216-
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
217-
export PATH=\$HOME/.cargo/bin:\$PATH
218-
source /opt/rh/gcc-toolset-12/enable
219-
export CC=clang
220-
export CXX=clang++
221-
TOOLCHAIN_ROOT=/opt/rh/gcc-toolset-12/root/usr
222-
export CFLAGS=\"--gcc-toolchain=\$TOOLCHAIN_ROOT\"
223-
export CXXFLAGS=\"--gcc-toolchain=\$TOOLCHAIN_ROOT\"
224-
cd /workspace
225-
CI=true pnpm install
226-
cd packages/livekit-rtc
227-
pnpm build --target $TARGET
228-
cd ../..
229-
pnpm --filter "./packages/livekit-server-sdk" build
230-
export LIVEKIT_URL=${{ secrets.LIVEKIT_URL }}
231-
export LIVEKIT_API_KEY=${{ secrets.LIVEKIT_API_KEY }}
232-
export LIVEKIT_API_SECRET=${{ secrets.LIVEKIT_API_SECRET }}
233-
pnpm --filter "@livekit/rtc-node" test
234-
bun install
235-
bun test --concurrent
236-
237-
"
238-
'
239-
240-
- name: Build (macOS)
241-
if: ${{ matrix.platform == 'macos' }}
242-
env:
243-
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
244-
run: cd packages/livekit-rtc && pnpm build --target ${{ matrix.target }}
245-
246-
- name: Build (Windows)
247-
if: ${{ matrix.platform == 'windows' }}
248-
run: cd packages/livekit-rtc && pnpm build --target ${{ matrix.target }}
249-
250-
- name: Upload artifact
251-
uses: actions/upload-artifact@v4
252-
if: github.event_name != 'pull-request'
253-
with:
254-
name: bindings-${{ matrix.target }}
255-
path: packages/livekit-rtc/src/napi/${{ env.APP_NAME }}.*.node
256-
if-no-files-found: error
257-
258-
release:
259-
needs: build
90+
build_and_release:
26091
if: github.ref == 'refs/heads/main'
261-
name: Release
92+
name: Build and release
26293
runs-on: ubuntu-latest
26394
steps:
26495
- uses: actions/checkout@v5
@@ -275,20 +106,10 @@ jobs:
275106
run: pnpm install
276107

277108
- name: Build server SDK
278-
run: pnpm --filter=livekit-server-sdk build
279-
280-
- name: Download all artifacts
281-
uses: actions/download-artifact@v4
282-
with:
283-
path: packages/livekit-rtc/artifacts
284-
285-
- name: Move artifacts
286-
run: pnpm artifacts
287-
working-directory: packages/livekit-rtc
109+
run: pnpm --filter="livekit-server-sdk" build
288110

289-
- name: List packages
290-
run: ls -R ./packages/livekit-rtc/npm
291-
shell: bash
111+
- name: Build rtc-node
112+
run: pnpm --filter="@livekit/rtc-node" build
292113

293114
- name: Create Release Pull Request or Publish to npm
294115
id: changesets

.github/workflows/proto.yaml

Lines changed: 0 additions & 54 deletions
This file was deleted.

packages/livekit-rtc/.cargo/config.toml

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/livekit-rtc/Cargo.toml

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/livekit-rtc/build.rs

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/livekit-rtc/generate_proto.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)