Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ffi-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@
name: ffi-builds-${{ matrix.target }}
path: ${{ matrix.name }}.zip

build_node:
name: Build node bindings
runs-on: ubuntu-latest
steps:

release:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
name: Release to GH (Draft)
runs-on: ubuntu-latest
needs: build
Expand Down
214 changes: 214 additions & 0 deletions .github/workflows/node-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
name: node ffi binding build

permissions:
id-token: write # Required for OIDC
contents: write # Required to create GH releases
pull-requests: write # Required to interact with PRs

on:
workflow_dispatch:
inputs:
tag:
required: true
type: string
workflow_call:
inputs:
tag:
required: true
type: string

env:
CARGO_TERM_COLOR: always
TAG_NAME: ${{ inputs.tag || github.ref_name }}
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@v6
with:
submodules: recursive

- uses: pnpm/action-setup@v4

- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm

- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: ${{ matrix.target }}

- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "25.1"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
packages/livekit-ffi/.cargo-cache
packages/livekit-ffi/target/
key: ${{ matrix.target }}-cargo-${{ matrix.os }}

- name: Install dependencies
working-directory: livekit-ffi-node-bindings
run: pnpm install

- 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
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 artifact
uses: actions/upload-artifact@v4
if: github.event_name != 'pull-request'
with:
name: bindings-${{ matrix.target }}
path: livekit-ffi-node-bindings/src/napi/${{ env.APP_NAME }}.*.node
if-no-files-found: error

release:
needs: build
if: github.ref == 'refs/heads/main'
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: pnpm/action-setup@v4

- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: livekit-ffi-node-bindings/artifacts

- name: Move artifacts
run: pnpm artifacts
working-directory: livekit-ffi-node-bindings

- name: List packages
run: ls -R ./livekit-ffi-node-bindings/npm
shell: bash

- name: Set package version from tag
working-directory: livekit-ffi-node-bindings
run: |
# Extract version from tag (e.g., rust-sdks/[email protected] -> 0.12.43)
VERSION=$(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')
echo "Setting package version to $VERSION"
npm version $VERSION --no-git-tag-version
pnpm run version

- name: Build TS parts
working-directory: livekit-ffi-node-bindings
run: pnpm build:ts

- name: Publish
working-directory: livekit-ffi-node-bindings
run: pnpm publish --tag dev
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install VA-API/NVIDIA drivers and other dependencies for build
run: |
run: |
sudo apt update -y
sudo apt install \
libnvidia-compute-570 \
Expand Down Expand Up @@ -75,6 +75,14 @@ jobs:
with:
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}

call-node-ffi:
name: Call node FFI Builds
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
uses: ./.github/workflows/node-builds.yml
needs: release-plz-release
with:
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}

# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
Expand Down
91 changes: 91 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ members = [
"livekit-api",
"livekit-protocol",
"livekit-ffi",
"livekit-ffi-node-bindings",
"livekit-runtime",
"libwebrtc",
"soxr-sys",
Expand Down
Loading