Skip to content

Test npm package

Test npm package #57

Workflow file for this run

name: Test npm package
on:
workflow_dispatch:
inputs:
version:
description: 'Package version to test'
required: true
jobs:
test_npm_binaries:
runs-on: ${{ matrix.platforms }}
strategy:
fail-fast: false
matrix:
platforms: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2019, macos-13, macos-15 ]
node-version: [ 18.x, 20.x, 22.x, 23.x ]
exclude:
- platforms: ubuntu-20.04
node-version: 23.x
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up the unit tests
run: |
curl https://codeload.github.com/mmomtchev/node-gdal-async/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip
unzip repo.zip
mv node-gdal-async-${{ github.event.inputs.version }}/package.json .
mv node-gdal-async-${{ github.event.inputs.version }}/test .
mv node-gdal-async-${{ github.event.inputs.version }}/scripts .
npm install
- name: Install from npm
run: npm install --force gdal-async@${{ github.event.inputs.version }}
- name: Node options
shell: bash
run: echo 'MOCHA_NODE_OPTIONS=--v8-expose-gc' >> $GITHUB_ENV
if: matrix.node-version != '23.x'
- name: Node options
shell: bash
run: echo 'MOCHA_NODE_OPTIONS=--node-option=no-experimental-strip-types --node-option=expose-gc' >> $GITHUB_ENV
if: matrix.node-version == '23.x'
- name: Run the unit tests
run: |
cd test
npx mocha ${{ env.MOCHA_NODE_OPTIONS }} --reporter=tap -r ts-node/register -r _common.ts -r _hooks.ts --timeout 20000 *.test.ts
env:
TS_NODE_PROJECT: tsconfig.test.json
test_npm_rebuild:
runs-on: ${{ matrix.platforms }}
strategy:
fail-fast: false
matrix:
platforms: [ ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, windows-2019, macos-13, macos-15 ]
node-version: [ 18.x, 20.x, 22.x, 23.x ]
exclude:
- platforms: ubuntu-20.04
node-version: 23.x
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Set up the unit tests
run: |
curl https://codeload.github.com/mmomtchev/node-gdal-async/zip/refs/tags/v${{ github.event.inputs.version }} --output repo.zip
unzip repo.zip
mv node-gdal-async-${{ github.event.inputs.version }}/package.json .
mv node-gdal-async-${{ github.event.inputs.version }}/test .
mv node-gdal-async-${{ github.event.inputs.version }}/scripts .
npm install
- name: Rebuild with npm
run: npm install --verbose --force gdal-async@${{ github.event.inputs.version }} --build-from-source
- name: Node options
shell: bash
run: echo 'MOCHA_NODE_OPTIONS=--v8-expose-gc' >> $GITHUB_ENV
if: matrix.node-version != '23.x'
- name: Node options
shell: bash
run: echo 'MOCHA_NODE_OPTIONS=--node-option=no-experimental-strip-types --node-option=expose-gc' >> $GITHUB_ENV
if: matrix.node-version == '23.x'
- name: Run the unit tests
run: |
cd test
npx mocha ${{ env.MOCHA_NODE_OPTIONS }} --reporter=tap -r ts-node/register -r _common.ts -r _hooks.ts --timeout 20000 *.test.ts
env:
TS_NODE_PROJECT: tsconfig.test.json