Skip to content

Merge pull request #9 from Mearman/github-ci #2

Merge pull request #9 from Mearman/github-ci

Merge pull request #9 from Mearman/github-ci #2

Workflow file for this run

name: Node.js CI
on:
push:
pull_request:
branches:
- "main"
jobs:
audit:
name: Audit packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Audit packages
run: npm audit --audit-level moderate
env:
CI: true
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 18.x
- 20.x
- 22.x
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"
- name: Next.js cache # see https://nextjs.org/docs/pages/building-your-application/deploying/ci-build-caching#github-actions
uses: actions/cache@v4
with:
path: |
~/.npm
${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- run: npm ci
- run: npm run build --if-present
- run: npm run test --if-present