Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

test(backend): Phase 2 - Add Missing Security & Error Handling Tests #422

test(backend): Phase 2 - Add Missing Security & Error Handling Tests

test(backend): Phase 2 - Add Missing Security & Error Handling Tests #422

Workflow file for this run

name: CI
on:
workflow_dispatch:
push:
branches:
- 'claude/**'
paths-ignore:
- '**.md'
- 'docs/**'
- '.vscode/**'
- '.idea/**'
- 'LICENSE'
- '.gitignore'
pull_request:
branches:
- main
- 'claude/**'
paths-ignore:
- '**.md'
- 'docs/**'
- '.vscode/**'
- '.idea/**'
- 'LICENSE'
- '.gitignore'
# Cancel in-progress runs for the same PR/branch
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
# Detect which packages changed to optimize test runs
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
shared: ${{ steps.filter.outputs.shared }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check for file changes
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
backend:
- 'packages/backend/**'
- 'packages/shared/**'
- 'package.json'
- 'package-lock.json'
frontend:
- 'packages/frontend/**'
- 'packages/shared/**'
- 'package.json'
- 'package-lock.json'
shared:
- 'packages/shared/**'
- 'package.json'
- 'package-lock.json'
# Shared package tests
test-shared:
name: Test Shared Package
needs: changes
if: needs.changes.outputs.shared == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build shared package
run: npm run build:shared
- name: Run shared tests with coverage
run: npm run test:coverage:shared
- name: Display coverage summary
if: always()
run: |
echo "## 📊 Shared Package Coverage" >> $GITHUB_STEP_SUMMARY
if [ -f packages/shared/coverage/coverage-summary.json ]; then
node -e "
const data = require('./packages/shared/coverage/coverage-summary.json');
const total = data.total;
console.log('| Metric | Coverage |');
console.log('|--------|----------|');
console.log('| Lines | ' + total.lines.pct + '% |');
console.log('| Statements | ' + total.statements.pct + '% |');
console.log('| Functions | ' + total.functions.pct + '% |');
console.log('| Branches | ' + total.branches.pct + '% |');
" >> $GITHUB_STEP_SUMMARY
else
echo "No coverage data available (no tests or coverage not generated)" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload test coverage
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: shared-coverage
path: packages/shared/coverage/
retention-days: 7
if-no-files-found: ignore
# Backend tests
test-backend:
name: Test Backend
needs: changes
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['22', '24']
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build shared package
run: npm run build:shared
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
working-directory: packages/backend
- name: Run backend tests with coverage
run: npm run test:coverage:backend
- name: Display coverage summary
if: always() && matrix.node-version == '22'
run: |
echo "## 📊 Backend Package Coverage" >> $GITHUB_STEP_SUMMARY
if [ -f packages/backend/coverage/coverage-summary.json ]; then
node -e "
const data = require('./packages/backend/coverage/coverage-summary.json');
const total = data.total;
console.log('| Metric | Coverage |');
console.log('|--------|----------|');
console.log('| Lines | ' + total.lines.pct + '% |');
console.log('| Statements | ' + total.statements.pct + '% |');
console.log('| Functions | ' + total.functions.pct + '% |');
console.log('| Branches | ' + total.branches.pct + '% |');
" >> $GITHUB_STEP_SUMMARY
else
echo "No coverage data available" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload test coverage
if: matrix.node-version == '22'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: backend-coverage
path: packages/backend/coverage/
retention-days: 7
if-no-files-found: ignore
# Frontend tests
test-frontend:
name: Test Frontend
needs: changes
if: needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build shared package
run: npm run build:shared
- name: Run frontend tests with coverage
run: npm run test:coverage:frontend
- name: Display coverage summary
if: always()
run: |
echo "## 📊 Frontend Package Coverage" >> $GITHUB_STEP_SUMMARY
if [ -f packages/frontend/coverage/coverage-summary.json ]; then
node -e "
const data = require('./packages/frontend/coverage/coverage-summary.json');
const total = data.total;
console.log('| Metric | Coverage |');
console.log('|--------|----------|');
console.log('| Lines | ' + total.lines.pct + '% |');
console.log('| Statements | ' + total.statements.pct + '% |');
console.log('| Functions | ' + total.functions.pct + '% |');
console.log('| Branches | ' + total.branches.pct + '% |');
" >> $GITHUB_STEP_SUMMARY
else
echo "No coverage data available (no tests or coverage not generated)" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload test coverage
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: frontend-coverage
path: packages/frontend/coverage/
retention-days: 7
if-no-files-found: ignore
# Lint and format check
lint:
name: Lint & Format Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Run biome CI check
run: npx -y @biomejs/biome@2.3.11 ci
# Security audit
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
with:
node-version: '22'
- name: Run npm audit
run: npm audit --audit-level=moderate