Skip to content

Add admin VPS console, tips persistence, HTTPS health, safe path handling and admin UX improvements #181

Add admin VPS console, tips persistence, HTTPS health, safe path handling and admin UX improvements

Add admin VPS console, tips persistence, HTTPS health, safe path handling and admin UX improvements #181

Workflow file for this run

name: CI
# -----------------------------------------------------------------------------
# PURPOSE:
# - Runs on all PRs and pushes to non-main branches.
# - Fast, deterministic quality gate: syntax → tests → audit → smoke.
# - Never deploys. Never touches the VPS. Never writes artifacts.
# - Uses the SAME GitHub Actions environment as production for parity.
# - Full deploy pipeline lives in deploy.yml (main branch only).
# -----------------------------------------------------------------------------
on:
pull_request:
push:
branches-ignore: [main]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: false
env:
NODE_ENV: test
CI: true
FORCE_COLOR: 0
jobs:
# ---------------------------------------------------------------------------
# Job 1: Validate (syntax, tests, audit)
# ---------------------------------------------------------------------------
validate:
name: Validate
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# -------------------------------
# Node + npm + cache
# -------------------------------
- name: Setup Node.js 20 (with npm cache)
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
# -------------------------------
# Restore node_modules cache
# -------------------------------
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node-modules-${{ runner.os }}-
- name: Install dependencies (clean, deterministic)
run: |
if [ -d node_modules ]; then
echo "Using cached node_modules"
else
echo "Cache miss — running npm ci"
npm ci --no-audit --no-fund
fi
# -------------------------------
# Syntax / lint / type checks
# -------------------------------
- name: Syntax / lint / type checks
run: npm run check
# -------------------------------
# Unit tests (fail-fast)
# -------------------------------
- name: Run tests
run: npm test
# -------------------------------
# Security audit (warn only)
# -------------------------------
- name: Security audit (high + critical only, non-blocking)
continue-on-error: true
run: |
npm audit --audit-level=high || true
# ---------------------------------------------------------------------------
# Job 2: Smoke test (lightweight integration)
# Uses the SAME Production environment for exact parity.
# Does NOT start listeners or long-running processes.
# ---------------------------------------------------------------------------
smoke:
name: Smoke Test
runs-on: ubuntu-latest
timeout-minutes: 5
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# -------------------------------
# Node + npm + cache
# -------------------------------
- name: Setup Node.js 20 (with npm cache)
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Restore node_modules cache
id: cache-node-modules
uses: actions/cache@v4
with:
path: |
node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: |
node-modules-${{ runner.os }}-
- name: Install dependencies (clean)
run: |
if [ -d node_modules ]; then
echo "Using cached node_modules"
else
echo "Cache miss — running npm ci"
npm ci --no-audit --no-fund
fi
# -------------------------------
# Entrypoint integrity
# -------------------------------
- name: Node syntax validation
run: |
node --check index.js
echo "✅ index.js syntax OK"
# -------------------------------
# Require-only smoke (no runtime)
# -------------------------------
- name: Require entrypoint without side effects
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
DISABLE_RUNTIME: "1"
NODE_ENV: test
run: |
node - <<'EOF'
process.env.CI = 'true'
process.env.DISABLE_RUNTIME = '1'
require('./index.js')
console.log('✅ index.js required successfully (no crash)')
EOF
# -------------------------------
# Dependency tree sanity (fast, non-blocking)
# -------------------------------
- name: Dependency resolution sanity
run: |
npm ls --depth=0 >/dev/null 2>&1 || true