forked from metalogical/BigFiles
-
Notifications
You must be signed in to change notification settings - Fork 1
159 lines (130 loc) · 4.87 KB
/
Copy pathworkflow-validation.yml
File metadata and controls
159 lines (130 loc) · 4.87 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# GitHub Actions CI - 技术门禁
# 职责:仅验证技术指标(测试 / 风格 / 构建)
# 过程约束(TDD 流程、提示词归档、审查报告)由 AI Agent 负责,不在此处检查
#
# 来源:ai-standardization-kit/github-workflows/workflow-validation.yml
# 适配:BigFiles (Go 1.26.5)
name: AI Workflow Validation
on:
pull_request:
branches:
- master
- main
- 'release/**'
jobs:
# ============================================================================
# 技术门禁 1:测试验证
# ============================================================================
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.5'
cache: true
- name: Run tests
run: go test ./...
- name: Generate coverage report
run: go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out
continue-on-error: true
# ============================================================================
# 技术门禁 2:代码风格检查
# ============================================================================
code-style:
name: Code Style Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.5'
cache: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: latest
# ============================================================================
# 技术门禁 3:构建验证
# ============================================================================
build:
name: Build Verification
runs-on: ubuntu-latest
needs: [test, code-style]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26.5'
cache: true
- name: Build project
run: go build ./...
- name: Go vet
run: go vet ./...
# ============================================================================
# 技术门禁 4:Python 辅助脚本测试与覆盖率
# 说明:项目主体是 Go,Python 仅用于 scripts/ 下的运维辅助脚本。
# 生成 coverage.xml 供外部 SAST CI 的 diff-cover 消费。
# ============================================================================
python-test:
name: Python Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: pip install -r requirements-dev.txt
- name: Run pytest with coverage
run: pytest
- name: Upload coverage.xml
uses: actions/upload-artifact@v4
if: always()
with:
name: python-coverage
path: coverage.xml
# ============================================================================
# 汇总报告
# ============================================================================
summary:
name: CI Summary
runs-on: ubuntu-latest
needs: [test, code-style, build, python-test]
if: always()
steps:
- name: Generate summary
run: |
echo "## CI 技术门禁结果" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| 检查项 | 结果 |" >> $GITHUB_STEP_SUMMARY
echo "|--------|------|" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test.result }}" = "success" ]; then
echo "| ✅ 测试通过 | 通过 |" >> $GITHUB_STEP_SUMMARY
else
echo "| ❌ 测试失败 | 失败 |" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.code-style.result }}" = "success" ]; then
echo "| ✅ 代码风格 | 通过 |" >> $GITHUB_STEP_SUMMARY
else
echo "| ❌ 代码风格 | 失败 |" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.build.result }}" = "success" ]; then
echo "| ✅ 构建验证 | 通过 |" >> $GITHUB_STEP_SUMMARY
else
echo "| ❌ 构建失败 | 失败 |" >> $GITHUB_STEP_SUMMARY
fi
if [ "${{ needs.python-test.result }}" = "success" ]; then
echo "| ✅ Python 测试 | 通过 |" >> $GITHUB_STEP_SUMMARY
else
echo "| ❌ Python 测试 | 失败 |" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "> **注意**:CI 仅验证技术指标。TDD 流程合规、提示词归档、审查报告等过程要求由 AI Agent 在提交前自动执行。" >> $GITHUB_STEP_SUMMARY