From 4fdf190d694503889da496b4e2d69895a28e5f2a Mon Sep 17 00:00:00 2001 From: xiong Date: Tue, 21 Jul 2026 17:35:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20CI=20=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=B5=81=EF=BC=8C=E7=AE=80=E5=8C=96=E6=AD=A5=E9=AA=A4?= =?UTF-8?q?=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=8E=AF=E5=A2=83=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 65 +++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 41 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 97d2033..43537d8 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,59 +1,42 @@ -# PR 自动检查:代码风格 + 类型检查 + 测试 -name: CI 检查 +name: CI + +env: + NPM_CONFIG_REGISTRY: https://registry.npmmirror.com + NPM_CONFIG_AUDIT: "false" + NPM_CONFIG_FUND: "false" + NPM_CONFIG_PREFER_OFFLINE: "true" + NPM_CONFIG_REPLACE_REGISTRY_HOST: always + CI: "true" + TURBO_UI: stream on: pull_request: branches: [main] - push: - branches: [main] - -# 同一分支有新提交时取消旧任务,避免旧任务持续占用 Gitea runner。 -concurrency: - group: ci-${{ gitea.ref }} - cancel-in-progress: true + workflow_dispatch: jobs: - verify: + check: runs-on: ubuntu-latest + container: node:20.20.2-bookworm timeout-minutes: 30 - env: - CI: 'true' - TURBO_UI: stream + steps: - - name: 检出代码 - uses: actions/checkout@v4 - timeout-minutes: 3 + - name: Checkout + uses: https://gitee.com/mirrors_actions/checkout@v4 - - name: 安装 Node.js - uses: actions/setup-node@v4 - timeout-minutes: 3 - with: - node-version: '22' - cache: npm + - name: Install dependencies + run: npm ci - - name: 安装依赖 - run: npm ci --no-audit --no-fund - timeout-minutes: 10 - - - name: 代码检查 - # 后端原 lint 脚本带 --fix;CI 中追加 --no-fix,避免检查时修改工作区。 + - name: Lint run: | npm run lint -w @gongxue/admin npm run lint -w @gongxue/server -- --no-fix - timeout-minutes: 5 - - name: 类型检查 + - name: Type check run: npm run typecheck - timeout-minutes: 8 - - name: 后端测试 + - name: Build frontend + run: npm run build -w @gongxue/admin + + - name: Run backend tests run: npm run test -w @gongxue/server -- --runInBand --forceExit - timeout-minutes: 10 - - - name: 安装 Chromium - run: npx playwright install --with-deps chromium - timeout-minutes: 10 - - - name: 前端测试 - run: npm run test -w @gongxue/admin - timeout-minutes: 10