Skip to content

Use OSMesa for macOS core tests #84

Use OSMesa for macOS core tests

Use OSMesa for macOS core tests #84

Workflow file for this run

name: Test
defaults:
run:
shell: bash
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
unit-tests:
name: Unit Tests (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- target: windows-x64
os: windows-2022
node_arch: x64
- target: windows-arm64
os: windows-11-arm
node_arch: arm64
- target: linux-x64
os: ubuntu-22.04
node_arch: x64
- target: linux-arm64
os: ubuntu-22.04-arm
node_arch: arm64
- target: darwin-x64
os: macos-26
node_arch: x64
- target: darwin-arm64
os: macos-26
node_arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Fetch Repository
uses: actions/checkout@v7
with:
persist-credentials: false
- name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 24.13.0
architecture: ${{ matrix.node_arch }}
cache: 'npm'
- name: Print Native Target
run: |
echo "runner=$(uname -s)-$(uname -m)"
node -p "'node=' + process.version + ' platform=' + process.platform + ' arch=' + process.arch"
npm config get arch
- name: Install Modules
run: npm ci
- name: Install MacOS OpenGL Runtime
if: matrix.target == 'darwin-x64' || matrix.target == 'darwin-arm64'
run: |
brew install mesa
mesa_prefix="$(brew --prefix mesa)"
echo "DYLD_LIBRARY_PATH=$mesa_prefix/lib:${DYLD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
echo "DYLD_FALLBACK_LIBRARY_PATH=$mesa_prefix/lib:${DYLD_FALLBACK_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
find "$mesa_prefix/lib" -maxdepth 1 \( -name '*OSMesa*' -o -name '*EGL*' -o -name '*GL*' \) -print
- name: Tests - Linux
if: matrix.target == 'linux-x64' || matrix.target == 'linux-arm64'
run: xvfb-run --auto-servernum npm run test:ci
- name: Validate Windows ARM64 Imports
if: matrix.target == 'windows-arm64'
run: |
npm run build:ci
node -e "import('./dist/index.js').then((m) => console.log(Object.keys(m).join(',')))"
node -e "import('@node-3d/core/testing').then((m) => console.log(Object.keys(m).join(',')))"
- uses: ssciwr/setup-mesa-dist-win@v3
if: matrix.target == 'windows-x64'
- name: Test - Windows
if: matrix.target == 'windows-x64'
run: npm run test:ci
- name: Probe MacOS OpenGL
if: matrix.target == 'darwin-x64' || matrix.target == 'darwin-arm64'
run: node .github/scripts/probe-macos-gl.mjs
- name: Test - MacOS
if: matrix.target == 'darwin-x64' || matrix.target == 'darwin-arm64'
run: npm run test:ci
- name: Check Diff Artifacts
id: diff-artifacts
if: matrix.target != 'darwin-x64' && matrix.target != 'darwin-arm64'
run: |
if [ -d test/__diff__ ] && find test/__diff__ -type f | read -r _; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/upload-artifact@v7
if: steps.diff-artifacts.outputs.present == 'true'
with:
name: __diff__-${{ matrix.target }}
path: test/__diff__
retention-days: 1
compression-level: 0
overwrite: true