-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (93 loc) · 3.24 KB
/
Copy pathquant_eval_gate.yml
File metadata and controls
105 lines (93 loc) · 3.24 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
name: Quant Eval Gate
on:
# PR check 由 tests.yml 的 quant_eval_gate job 统一管理 (避免重复跑)
# 这里只保留 manual trigger: 用户跑真实 quant_eval_report.json
workflow_dispatch:
inputs:
report_path:
description: "Path to quant_eval_report.json (real eval output)"
required: false
default: ""
jobs:
gate-fixtures:
name: Run quant_eval_gate (PASS + FAIL fixtures)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Gate on PASS fixture (expect exit 0)
run: |
python scripts/quant_eval_gate.py \
--report-path tests/fixtures/quant_eval_sample_pass.json
- name: Gate on FAIL fixture (expect exit 1)
# 不靠 exit code 反向断言 (Windows/PowerShell shell 兼容差),
# 直接用 dry-run + 检查打印里含 "FAIL"
run: |
set +e
output=$(python scripts/quant_eval_gate.py \
--report-path tests/fixtures/quant_eval_sample_fail.json 2>&1)
echo "$output"
if echo "$output" | grep -q "❌ FAIL"; then
echo "[OK] FAIL fixture 正确返回 FAIL"
exit 0
else
echo "[ERROR] FAIL fixture 未返回 FAIL"
exit 1
fi
- name: Gate default thresholds (verify all defaults are reachable)
run: |
python -c "
from scripts.quant_eval_gate import DEFAULT_THRESHOLDS, evaluate
print('DEFAULT_THRESHOLDS:', DEFAULT_THRESHOLDS)
assert all(k in DEFAULT_THRESHOLDS for k in
['f1_min', 'coverage_min', 'recall_min',
'confidence_min', 'feedback_delta_abs_max'])
print('OK all 5 thresholds defined')
"
gate-manual:
name: Manual gate (workflow_dispatch)
needs: gate-fixtures
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run gate on user-provided report
env:
REPORT_PATH: ${{ github.event.inputs.report_path }}
run: |
if [ -z "$REPORT_PATH" ]; then
echo "[skip] no report_path provided, 跳过 manual gate"
exit 0
fi
if [ ! -f "$REPORT_PATH" ]; then
echo "[error] report 不存在: $REPORT_PATH"
exit 2
fi
python scripts/quant_eval_gate.py --report-path "$REPORT_PATH"
- name: Upload gate artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: quant-eval-gate-result
path: |
**/quant_eval_gate_result.json
**/quant_eval_chart.png
**/quant_eval_report.html
if-no-files-found: ignore