Skip to content

ci: add GitHub Actions workflow for multi-platform testing #335

ci: add GitHub Actions workflow for multi-platform testing

ci: add GitHub Actions workflow for multi-platform testing #335

Workflow file for this run

# CI workflow for node-webcodecs
# Runs linting, building, and testing on all supported platforms
#
# Platforms:
# - Linux x64 glibc (Rocky Linux 8 container)
# - Linux x64 musl (Alpine 3.20 container)
# - macOS ARM64 (macos-14 runner)
# - macOS x64 (macos-13 runner)
#
# Node.js versions: 20, 22 (matching engines field)
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
permissions:
contents: read
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install cpplint
run: pip install cpplint
- name: Install dependencies
run: npm install
- name: Build TypeScript
run: npm run build:ts
- name: Lint C++
run: cpplint --quiet src/*.h src/*.cc
- name: Lint TypeScript
run: npm run lint:ts
- name: Lint types
run: npm run lint:types
- name: Lint markdown
run: npm run lint:md
build-linux-glibc:
name: Linux glibc (Node ${{ matrix.node }})
runs-on: ubuntu-24.04
container: rockylinux:8
strategy:
matrix:
node: [20, 22]
steps:
- name: Install system dependencies
run: |
# Enable EPEL and CRB (PowerTools) repositories
dnf install -y epel-release
dnf config-manager --set-enabled powertools || dnf config-manager --set-enabled crb || true
# Install GCC Toolset 12 for C++20 support (Rocky 8 default GCC is 8.x)
dnf install -y gcc-toolset-12 make python39 git pkgconfig
alternatives --set python3 /usr/bin/python3.9 || true
# Install FFmpeg via RPMFusion (EPEL doesn't have ffmpeg-devel for Rocky 8)
dnf install -y https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm || true
dnf install -y ffmpeg-devel || true
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install --omit=optional
- name: Build
run: |
# Enable GCC Toolset 12 for C++20 support
source /opt/rh/gcc-toolset-12/enable
npm run build
- name: Test
run: npm test
build-linux-musl:
name: Linux musl (Node ${{ matrix.node }})
runs-on: ubuntu-24.04
container: alpine:3.20
strategy:
matrix:
node: [20, 22]
steps:
- name: Install system dependencies
run: |
# Install build tools and Node.js
apk add --no-cache build-base python3 pkgconfig git nodejs npm
# Install FFmpeg and all transitive dependencies required by pkg-config
# Alpine's FFmpeg is compiled with many optional features, all need their dev packages
apk add --no-cache \
ffmpeg-dev ffmpeg-libs \
x264-dev x265-dev libvpx-dev opus-dev libvorbis-dev lame-dev \
dav1d-dev aom-dev libtheora-dev libwebp-dev svt-av1-dev rav1e-dev \
libjxl-dev libogg-dev \
harfbuzz-dev fribidi-dev fontconfig-dev freetype-dev libass-dev \
zlib-dev bzip2-dev openssl-dev libxml2-dev \
soxr-dev libdrm-dev \
lilv-dev libplacebo-dev vidstab-dev zeromq-dev zimg-dev \
libva-dev vdpau-dev libX11-dev \
librist-dev srt-dev libssh-dev libbluray-dev openmpt-dev \
onevpl-dev || true
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: npm install --omit=optional
- name: Build
run: npm run build
- name: Test
run: npm test
build-macos-arm64:
name: macOS ARM64 (Node ${{ matrix.node }})
runs-on: macos-14
strategy:
matrix:
node: [20, 22]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install FFmpeg
run: brew install ffmpeg
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install --omit=optional
- name: Build
run: npm run build
- name: Test
run: npm test
build-macos-x64:
name: macOS x64 (Node ${{ matrix.node }})
runs-on: macos-13
strategy:
matrix:
node: [20, 22]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install FFmpeg
run: brew install ffmpeg
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install dependencies
run: npm install --omit=optional
- name: Build
run: npm run build
- name: Test
run: npm test