Files
cieanyau 651c36367f
前端验证 / verify (push) Failing after 15m2s
接入 ESLint 与 Prettier 并加入 CI 静态门禁
2026-11-07 01:24:36 +08:00

42 lines
1.7 KiB
YAML

# 仅做前端验证,不包含发布、服务器登录或生产凭证。
name: 前端验证
on:
push:
pull_request:
jobs:
verify:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: 获取源码
# Runner 所在网络访问 github.com 不稳定;使用 git.crash.work 上的副本(手动从 GitHub 推送更新)。
uses: https://git.crash.work/actions/checkout@v4
with:
persist-credentials: false
# Runner 位于中国大陆,ubuntu-latest 映射到自带 Node 22 的 node:22-bookworm-slim 镜像;
# 不再用 setup-node 从 GitHub 下载 Node(经常超时),只校验镜像内版本。
- name: 确认 Node.js
run: |
node -v
node -e 'if (Number(process.versions.node.split(".")[0]) !== 22) { console.error("需要 Node 22"); process.exit(1) }'
- name: 安装锁定依赖
run: npm ci
- name: 检查代码和格式
run: |
npm run lint
npm run format:check
- name: 安装测试浏览器
run: npx playwright install --with-deps chromium firefox
- name: 检查源码并构建
run: |
npm run check
npm run build
- name: 验收真实生产构建
run: |
task_chrome_path="$(node --input-type=module -e 'import { chromium } from "playwright"; process.stdout.write(chromium.executablePath())')"
CHROME_PATH="$task_chrome_path" npm test
# deepmerge 尚无上游修复版本;低危传播项保留在审计输出,不通过降级框架隐藏。
- name: 阻止中危及以上依赖风险
run: npm audit --audit-level=moderate