Initial Version #1
Workflow file for this run
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: 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) | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
path-filter: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
changes: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 | |
- uses: volta-cli/action@v4 | |
- run: npm ci | |
# Lint the source files | |
- run: npm start -- --help | |
- run: npm run lint | |
node-unit: | |
needs: | |
- path-filter | |
if: ${{ needs.path-filter.outputs.changes == 'true' }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
matrix: | |
os: [ ubuntu, macos, windows ] | |
node-version: [ lts, 18, 16.6.0 ] | |
steps: | |
# Setup and install | |
- uses: actions/checkout@v4 | |
- uses: volta-cli/action@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm ci | |
# Test the source files | |
- run: npm run test:unit | |
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 | |
- uses: volta-cli/action@v4 | |
- run: npm ci | |
# Test building | |
- run: npm run build | |
# !!! This check should be required by GitHub !!! | |
test-status-check: | |
if: always() | |
needs: | |
- path-filter | |
- node-lint | |
- node-unit | |
- node-build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: re-actors/alls-green@release/v1 | |
with: | |
allowed-skips: node-lint, node-unit, node-build | |
jobs: ${{ toJSON(needs) }} |