6b0de96b18
- fix: release.yml typecheck 脚本名 compile → typecheck(发版阻断 bug) - perf: CI 测试改用 test:coverage 生成覆盖率报告 - refactor: Release 复用 CI 工作流(workflow_call),消除重复 Job - feat: Release 新增 Firefox/Chrome zip 产物验证步骤 - fix: 补全 lint-staged 配置,修复 pre-commit hook 失效问题 - feat: 添加 Dependabot 自动依赖更新配置 - fix: 添加 @vitest/coverage-v8 依赖(覆盖率所需) - fix: 改用 npx 直接调用命令,规避 npm PATH 问题
92 lines
1.8 KiB
YAML
92 lines
1.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_call: # 允许 Release 工作流复用此 CI
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run ESLint
|
|
run: npx eslint . --max-warnings=0
|
|
|
|
typecheck:
|
|
name: TypeScript Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run TypeScript type check
|
|
run: npx tsc --noEmit
|
|
|
|
test:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Run tests with coverage
|
|
run: npx vitest run --coverage
|
|
|
|
build:
|
|
name: Build (${{ matrix.browser }})
|
|
runs-on: ubuntu-latest
|
|
needs: [lint, typecheck, test]
|
|
strategy:
|
|
matrix:
|
|
browser: [chrome]
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build (Chrome)
|
|
if: matrix.browser == 'chrome'
|
|
run: npx wxt build
|