Skip to content

Test npm package

Test npm package #43

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:
matrix:
platforms: [ ubuntu-20.04, ubuntu-22.04, windows-2019, macos-11 ]
node-version: [ 16.x, 18.x, 20.x, 21.x ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v4
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 .
npm install
- name: Install from npm
run: npm install --force gdal-async@${{ github.event.inputs.version }}
- name: Run the unit tests
run: |
cd test
npx mocha --reporter=tap -r ts-node/register -r _common.ts -r _hooks.ts --timeout 20000 --v8-expose-gc *.test.ts
env:
TS_NODE_PROJECT: tsconfig.test.json
test_npm_rebuild:
runs-on: ${{ matrix.platforms }}
strategy:
matrix:
platforms: [ ubuntu-20.04, ubuntu-22.04, windows-2019, macos-11 ]
node-version: [ 16.x, 18.x, 20.x, 21.x ]
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-python@v4
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 .
npm install
- name: Rebuild with npm
run: npm install --verbose --force gdal-async@${{ github.event.inputs.version }} --build-from-source
- name: Run the unit tests
run: |
cd test
npx mocha --reporter=tap -r ts-node/register -r _common.ts -r _hooks.ts --timeout 20000 --v8-expose-gc *.test.ts
env:
TS_NODE_PROJECT: tsconfig.test.json