-
Notifications
You must be signed in to change notification settings - Fork 57
92 lines (75 loc) · 2.65 KB
/
Copy pathci.yml
File metadata and controls
92 lines (75 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: CI
on:
push:
branches: [main, dev]
pull_request:
branches: [main, dev]
# 同一分支上新推送取消尚未完成的旧运行
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
backend:
name: 后端构建与测试
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: 安装 .NET SDK
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
- name: 缓存 NuGet 包
uses: actions/cache@v6
with:
path: ~/.nuget/packages
key: nuget-${{ runner.os }}-${{ hashFiles('backend/**/*.csproj', 'backend/props/*.props') }}
restore-keys: nuget-${{ runner.os }}-
# 走 NuGet 包模式:解决方案名不以 XiHanFun 开头,props/framework.props 判定为包引用
- name: 还原
run: dotnet restore backend/XiHan.BasicApp.slnx
- name: 构建
run: dotnet build backend/XiHan.BasicApp.slnx -c Release --no-restore
- name: 测试
run: dotnet test backend/XiHan.BasicApp.slnx -c Release --no-build --logger "trx;LogFileName=test-results.trx"
- name: 上传测试结果
if: always()
uses: actions/upload-artifact@v7
with:
name: backend-test-results
path: '**/TestResults/*.trx'
if-no-files-found: ignore
frontend:
name: 前端类型检查与静态检查
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v7
# action 在仓库根目录执行,默认只找根 package.json;本仓库的清单在 frontend/ 下,
# 故显式指路,版本仍取自它的 packageManager 字段,不在此处再写一份版本号。
- name: 安装 pnpm
uses: pnpm/action-setup@v6
with:
package_json_file: frontend/package.json
# 本仓库不跟踪 pnpm-lock.yaml,缓存键改用版本事实源:catalog 所在的
# pnpm-workspace.yaml 与入口清单 package.json,二者任一变动即失效重装。
- name: 安装 Node
uses: actions/setup-node@v7
with:
node-version: '24'
cache: pnpm
cache-dependency-path: |
frontend/pnpm-workspace.yaml
frontend/package.json
# 无锁文件可冻结,装的是 catalog 里 ^ 范围内的最新解析结果
- name: 安装依赖
run: pnpm install --no-frozen-lockfile
- name: 类型检查
run: pnpm run type-check
- name: 静态检查
run: pnpm run lint
- name: 文案与模块门禁
run: pnpm run validate