Test npm package #40
This file contains 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
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@v3 | |
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@v3 | |
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 |