Skip to content

Revive for modern Node.js: Node-API, vendored Lua, tests, CI #4

Revive for modern Node.js: Node-API, vendored Lua, tests, CI

Revive for modern Node.js: Node-API, vendored Lua, tests, CI #4

Workflow file for this run

name: CI
on:
push:
branches: [master, main]
pull_request:
workflow_dispatch:
jobs:
build:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# macos-latest is arm64, which is exactly the configuration that could not
# build before Lua was vendored.
os: [ubuntu-latest, macos-latest, windows-latest]
node: [20, 22, 24]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# The node-gyp bundled with npm on Node 20 and 22 cannot detect Visual
# Studio 18, which is what the windows-latest image now ships, and bails
# with 'unknown version "undefined"'. Node 24 already carries a new enough
# node-gyp. Point npm at a current one so every Node version can build.
# node-gyp 11.x cannot detect Visual Studio 18, which windows-latest now
# ships: its vswhere probe overflows the child-process stdio buffer and it
# reports 'unknown version "undefined"'. node-gyp 12 handles it.
#
# Pin the version rather than using @latest, which resolves per Node major
# via engines and still lands on 11.x for Node 20 and 22. Install it to a
# path we control, then point npm's bundled shim at it through
# $npm_config_node_gyp ('npm config set node_gyp' was removed in npm 11).
- name: Install a node-gyp that supports current Visual Studio
if: runner.os == 'Windows'
shell: pwsh
run: |
npm install --prefix "$env:RUNNER_TEMP\gyp" --no-save node-gyp@12
$gyp = "$env:RUNNER_TEMP\gyp\node_modules\node-gyp\bin\node-gyp.js"
node $gyp --version
"npm_config_node_gyp=$gyp" >> $env:GITHUB_ENV
# Compiles the addon along with the vendored Lua and LuaFileSystem sources.
- name: Install and build
run: npm install
- name: Test
run: npm test
- name: Check the published tarball contents
run: npm pack --dry-run