Skip to content

ci(ci): add node 24 to test matrix (#314) #630

ci(ci): add node 24 to test matrix (#314)

ci(ci): add node 24 to test matrix (#314) #630

Workflow file for this run

name: CI
# **What it does**: Runs tests.
# **Why we have it**: Ensures tests pass before merging code.
on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
types: [opened, ready_for_review, reopened, synchronize]
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
permissions:
contents: read
jobs:
dependency-review:
name: Dependency Review
if: >
github.event.pull_request.draft == false &&
github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Dependency review
uses: actions/dependency-review-action@ce3cf9537a52e8119d91fd484ab5b8a807627bf8 # v4.6.0
lint:
name: Lint Code
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
check-latest: true
node-version: lts/*
- name: Install
run: npm i --ignore-scripts
- name: Audit NPM package signatures and provenance attestations
run: npm audit signatures
- name: Run ESLint
run: npm run lint
- name: Run Prettier
run: npm run lint:prettier
- name: Run License Checker
run: npm run lint:licenses
- name: Run build
run: npm run build --if-present
commit-lint:
name: Lint Commit Messages
if: >
github.event.pull_request.draft == false &&
github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
persist-credentials: false
- name: Run Commitlint
uses: wagoid/commitlint-github-action@b948419dd99f3fd78a6548d48f94e3df7f6bf3ed # v6.2.1
with:
configFile: ./package.json
unit-tests:
name: Unit Tests
if: github.event.pull_request.draft == false
strategy:
matrix:
node-version: [20, 22, 24]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Check out repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
check-latest: true
node-version: ${{ matrix.node-version }}
- name: Install
run: npm i --ignore-scripts
- name: Run tests
run: npm run test:unit:coverage
- name: Coveralls parallel
if: github.repository == 'Fdawgs/fastify-disablecache'
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
flag-name: run-${{ matrix.node-version }}-${{ matrix.os }}
coverage:
name: Aggregate Coverage Calculations
needs: unit-tests
if: >
github.event.pull_request.draft == false &&
github.repository == 'Fdawgs/fastify-disablecache'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Coveralls finished
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
automerge:
name: Automerge Dependabot PRs
needs: unit-tests
if: >
github.event.pull_request.draft == false &&
github.event_name == 'pull_request' &&
github.event.pull_request.user.login == 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: write
steps:
- uses: fastify/github-action-merge-dependabot@e820d631adb1d8ab16c3b93e5afe713450884a4a # v3.11.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
merge-method: squash