Skip to content

CI fixes: cache npm, Node 20, fallback type-check, optional build #51

CI fixes: cache npm, Node 20, fallback type-check, optional build

CI fixes: cache npm, Node 20, fallback type-check, optional build #51

Workflow file for this run

name: CI
on:
push:
branches: [ "**" ]
pull_request:
branches: [ "**" ]
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: |
if [ -f package-lock.json ]; then npm ci; else npm install; fi
- name: Security audit
run: npm audit --audit-level=moderate || true
- name: Lint
run: npx eslint . --ext .ts || true
- name: Type check
run: |
if npm run type-check --silent; then exit 0; fi
npx tsc --noEmit
- name: Test
env:
CI: true
run: npm test -- --coverage || true
- name: Build
env:
CI: true
run: npm run build --if-present