Skip to content

Feature: v3.0.0

Feature: v3.0.0 #1688

Workflow file for this run

# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# https://hanxiao.io/2021/01/24/Speedup-CI-Workflow-in-Github-Actions-via-Strategy-Matrix/
name: Node.js Test
on:
pull_request:
types:
# - edited # PR's base branch was changed
- opened
- reopened
- synchronize # PR's branch was edited (i.e. new commits)
workflow_dispatch:
inputs:
ref:
description: 'Git ref or SHA'
required: true
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ref: ${{ inputs.ref || github.sha || github.ref }}
jobs:
path-filter:
permissions:
pull-requests: read
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- id: filter
uses: dorny/paths-filter@v2
with:
filters: |
changes:
- '.github/workflows/node-test.yml'
- 'src/**'
- 'test/**'
- '*'
node-lint:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
steps:
# Setup and install
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: volta-cli/action@v4
- run: npm ci
# Lint the source files
- run: npm start -- --help
- run: npm run lint
# TODO(cemmer): check for deprecated dependencies
# https://stackoverflow.com/questions/44097267/find-packages-that-give-deprecated-warning-npm
node-unit:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 10
strategy:
matrix:
os: [ ubuntu, macos, windows ]
node-version: [ lts, 18, 16.7.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- if: ${{ matrix.os == 'macos' }}
run: brew install --overwrite sdl2
- if: ${{ matrix.os == 'ubuntu' }}
run: |
sudo apt-get update
sudo apt-get install -y libsdl2-2.0-0 libsdl2-ttf-2.0-0
# Test the source files
- run: npm run test:unit
node-e2e:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
matrix:
node-version: [ lts, 18, 16.7.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: |
sudo apt-get update
sudo apt-get install -y libsdl2-2.0-0 libsdl2-ttf-2.0-0
# Test the built files
- run: npm run build
- run: ./test/endToEndTest.sh
node-build:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
os: [ ubuntu, macos, windows ]
steps:
# Setup and install
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: volta-cli/action@v4
- run: npm ci
# Test building
- run: npm run build
node-package:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ lts, 18, 16.7.0 ]
steps:
# Setup and install
- uses: actions/checkout@v4
with:
ref: ${{ env.ref }}
- uses: volta-cli/action@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
# Test the packaging
- run: |
npm pack
tar -xvzf igir-*.tgz
cd package
npm install --ignore-scripts
./dist/index.js --help
cd ..
rm -rf package
# !!! This check should be required by GitHub !!!
test-status-check:
if: always()
needs:
- path-filter
- node-lint
- node-unit
- node-e2e
- node-build
- node-package
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@release/v1
with:
allowed-skips: node-lint, node-unit, node-e2e, node-build, node-package
jobs: ${{ toJSON(needs) }}