Skip to content

ci: sync workflows from central-workflows #46

ci: sync workflows from central-workflows

ci: sync workflows from central-workflows #46

Workflow file for this run

# SPDX-License-Identifier: Apache-2.0
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_SCOPE: "@frmscoe"
NPM_REGISTRY: "https://npm.pkg.github.com/"
NODE_ENV: 'test'
STARTUP_TYPE: 'nats'
on:
push:
branches: [ "dev", "main" ]
pull_request:
branches: [ "dev", "main" ]
jobs:
build:
runs-on: ubuntu-latest
name: run build
strategy:
matrix:
node-version: [16, 20]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: ${{ env.NPM_REGISTRY }}
scope: ${{ env.NPM_SCOPE }}
- name: Install dependencies
run: npm ci
- name: Run build
run: npm run build
lint:
runs-on: ubuntu-latest
name: check style
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: ${{ env.NPM_REGISTRY }}
scope: ${{ env.NPM_SCOPE }}
- name: Install dependencies
run: npm ci
- name: Check linting
run: npm run lint
- name: Check formatting
run: npm run lint:prettier
test:
runs-on: ubuntu-latest
name: check tests
strategy:
matrix:
node-version: [20]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
registry-url: ${{ env.NPM_REGISTRY }}
scope: ${{ env.NPM_SCOPE }}
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test