Skip to content

Commit 6ea5932

Browse files
Update ci.yml
1 parent d490d6b commit 6ea5932

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,83 @@
11
name: CI
22

33
# ──────────────────────────────────────────────────────────────────────────────
4-
# Runs on every pull request and on pushes to non-main branches.
5-
# Purpose: Fast quality gate (syntax + tests + audit).
6-
# The full deploy pipeline lives in deploy.yml (push to main only).
4+
# PURPOSE:
5+
# - Runs on all PRs and pushes to non-main branches.
6+
# - Fast, deterministic quality gate: syntax → tests → audit → smoke.
7+
# - Never deploys. Never touches the VPS. Never writes artifacts.
8+
# - Full deploy pipeline lives in deploy.yml (main branch only).
79
# ──────────────────────────────────────────────────────────────────────────────
810
on:
911
pull_request:
1012
push:
1113
branches-ignore: [main]
1214

13-
# Minimal read-only permissions — no write access needed for CI validation
1415
permissions:
1516
contents: read
1617

1718
jobs:
19+
20+
# ────────────────────────────────────────────────────────────────────────────
21+
# Job 1: Validate (syntax, tests, audit)
22+
# ────────────────────────────────────────────────────────────────────────────
1823
validate:
1924
name: Validate
2025
runs-on: ubuntu-latest
2126

2227
steps:
23-
- uses: actions/checkout@v4
28+
- name: Checkout
29+
uses: actions/checkout@v4
2430

25-
- uses: actions/setup-node@v4
31+
- name: Setup Node.js 20
32+
uses: actions/setup-node@v4
2633
with:
2734
node-version: '20'
2835
cache: 'npm'
2936

3037
- name: Install dependencies
3138
run: npm ci
3239

40+
# Syntax / type / lint checks
3341
- name: Syntax check
3442
run: npm run check
3543

44+
# Unit tests (fail-fast)
3645
- name: Run tests
3746
run: npm test
3847

48+
# Security audit (warn only)
3949
- name: Security audit (high+critical only)
4050
run: npm audit --audit-level=high
41-
continue-on-error: true # Warn but don't block PR for advisories
51+
continue-on-error: true
4252

43-
# Lightweight integration check (does the bot start without crashing?)
53+
# ────────────────────────────────────────────────────────────────────────────
54+
# Job 2: Smoke test (lightweight integration)
55+
# Ensures the bot can be required without crashing.
56+
# Does NOT start the bot (no BOT_TOKEN in CI).
57+
# ────────────────────────────────────────────────────────────────────────────
4458
smoke:
45-
name: Smoke
59+
name: Smoke Test
4660
runs-on: ubuntu-latest
4761
needs: validate
4862

4963
steps:
50-
- uses: actions/checkout@v4
64+
- name: Checkout
65+
uses: actions/checkout@v4
5166

52-
- uses: actions/setup-node@v4
67+
- name: Setup Node.js 20
68+
uses: actions/setup-node@v4
5369
with:
5470
node-version: '20'
5571
cache: 'npm'
5672

5773
- name: Install dependencies
5874
run: npm ci
5975

60-
- name: Check entrypoint can be required without errors
76+
- name: Validate entrypoint loads cleanly
6177
run: |
62-
# We can't fully start the bot (no BOT_TOKEN), but we can check
63-
# that the file is syntactically and structurally valid.
78+
# node --check ensures syntax correctness
6479
node --check index.js
6580
echo "✅ index.js passes node --check"
81+
82+
# Try requiring the bot without executing Telegram logic
83+
node -e "require('./index.js'); console.log('✅ index.js can be required without crashing')"

0 commit comments

Comments
 (0)