Runs on push/PR to main: npm ci → ESLint (no warnings) → Jest with coverage → upload artifact. Uses permissions: contents: read for supply-chain hardening. Node 20 matches package.json engine requirement.
43 lines
960 B
YAML
43 lines
960 B
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: dashcaddy-api/package-lock.json
|
|
|
|
- name: Install dependencies
|
|
working-directory: dashcaddy-api
|
|
run: npm ci
|
|
|
|
- name: Run ESLint
|
|
working-directory: dashcaddy-api
|
|
run: npx eslint . --max-warnings 0
|
|
|
|
- name: Run tests with coverage
|
|
working-directory: dashcaddy-api
|
|
run: npx jest --coverage --ci --coverageReporters=text --coverageReporters=text-lcov
|
|
|
|
- name: Upload coverage report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: coverage-report
|
|
path: dashcaddy-api/coverage/
|