ci: add GitHub Actions workflow for multi-platform testing #334
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 build tools (Python 3.9 for node-gyp compatibility) | |
| dnf install -y gcc-c++ 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: 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: apk add --no-cache ffmpeg-dev build-base python3 pkgconfig git nodejs npm | |
| - 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 |