Skip to content

docs: Add activation checklist for security automation #4

docs: Add activation checklist for security automation

docs: Add activation checklist for security automation #4

Workflow file for this run

name: CI - Tests & Build
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
jobs:
# Backend tests and build
backend:
name: Backend (Node.js ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
services:
postgres:
image: postgres:15
env:
POSTGRES_DB: flexgate_test
POSTGRES_USER: flexgate
POSTGRES_PASSWORD: flexgate
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🟢 Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: 📦 Install dependencies
run: npm ci
- name: 🔍 Lint code
run: npm run lint || echo "Lint not configured, skipping"
continue-on-error: true
- name: 🏗️ Build TypeScript
run: npm run build
- name: 🧪 Run tests
run: npm test
env:
NODE_ENV: test
DATABASE_URL: postgresql://flexgate:flexgate@localhost:5432/flexgate_test
- name: 📊 Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.node-version == '20.x'
with:
file: ./coverage/lcov.info
flags: backend
fail_ci_if_error: false
continue-on-error: true
# Admin UI tests and build
admin-ui:
name: Admin UI (React)
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🟢 Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
cache-dependency-path: admin-ui/package-lock.json
- name: 📦 Install dependencies
working-directory: ./admin-ui
run: npm ci
- name: 🔍 Lint code
working-directory: ./admin-ui
run: npm run lint || echo "Lint not configured, skipping"
continue-on-error: true
- name: 🧪 Run tests
working-directory: ./admin-ui
run: npm test -- --coverage --watchAll=false
env:
CI: true
- name: 🏗️ Build production bundle
working-directory: ./admin-ui
run: npm run build
- name: 📊 Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./admin-ui/coverage/lcov.info
flags: admin-ui
fail_ci_if_error: false
continue-on-error: true
# Security scan with CodeQL
security:
name: Security Scan (CodeQL)
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: ['javascript', 'typescript']
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🔍 Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
queries: security-extended,security-and-quality
- name: 🏗️ Autobuild
uses: github/codeql-action/autobuild@v3
- name: 🛡️ Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
# All checks passed - enable auto-merge
all-checks:
name: ✅ All Checks Passed
runs-on: ubuntu-latest
needs: [backend, admin-ui, security]
if: always()
steps:
- name: ✅ Verify all jobs succeeded
run: |
if [[ "${{ needs.backend.result }}" != "success" ]]; then
echo "Backend checks failed"
exit 1
fi
if [[ "${{ needs.admin-ui.result }}" != "success" ]]; then
echo "Admin UI checks failed"
exit 1
fi
if [[ "${{ needs.security.result }}" != "success" && "${{ needs.security.result }}" != "skipped" ]]; then
echo "Security checks failed"
exit 1
fi
echo "All checks passed! ✅"