* chore(ci): add Dependabot for npm and GitHub Actions updates - Weekly npm dependency updates with PR limit of 10 - Weekly GitHub Actions version updates with PR limit of 5 - Conventional commit prefixes (chore(deps), chore(ci)) * ci: add security audit workflow - Run npm audit on push/PR and weekly schedule - Fail on high-severity vulnerabilities using audit-ci - Only audit production dependencies * ci: add release-please for automated changelog and versioning - Auto-generate CHANGELOG.md from Conventional Commits - Create version bump PRs on push to main - Works alongside existing release.yml for npm publish * ci: add concurrency controls and Node.js version matrix - Add concurrency groups to ci, e2e-headed, security workflows to cancel duplicate runs on the same branch - Test unit tests across Node 18/20/22 with fail-fast: false - Update test step name to show Node version * chore: bump minimum Node.js version from 18 to 20 - Update engines.node in package.json to >=20.0.0 - Update prerequisites in README.md and README.zh-CN.md - Remove Node 18 from CI test matrix * review: fix release token and prod-only audit scope * docs: align Node 20 troubleshooting guidance --------- Co-authored-by: jackwener <jakevingoo@gmail.com>
89 lines
2.1 KiB
YAML
89 lines
2.1 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
schedule:
|
|
- cron: '0 8 * * 1' # Weekly Monday 08:00 UTC — smoke tests
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# ── Fast gate: typecheck + build ──
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Type check
|
|
run: npx tsc --noEmit
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
# ── Unit tests (vitest shard) ──
|
|
unit-test:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
node-version: ['20', '22']
|
|
shard: [1, 2]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run unit tests (Node ${{ matrix.node-version }}, shard ${{ matrix.shard }}/2)
|
|
run: npx vitest run src/ --reporter=verbose --shard=${{ matrix.shard }}/2
|
|
|
|
# ── Smoke tests (scheduled / manual only) ──
|
|
smoke-test:
|
|
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Setup Chrome + xvfb
|
|
uses: ./.github/actions/setup-chrome
|
|
id: setup-chrome
|
|
|
|
- name: Build
|
|
run: npm run build
|
|
|
|
- name: Run smoke tests
|
|
run: |
|
|
xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24" \
|
|
npx vitest run tests/smoke/ --reporter=verbose
|
|
env:
|
|
OPENCLI_BROWSER_EXECUTABLE_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}
|
|
timeout-minutes: 15
|