test: 实现端到端验收测试流程 (run_pipeline.py + acceptance.yml) - Closes #12
CI / test (pull_request) Successful in 8s

- scripts/run_pipeline.py: 完整管道运行器 (docx → IR → acceptance tests)
- acceptance.yml: 更新为 workflow_dispatch,支持 --input/--parsed/--test 三种模式
- 失败时自动创建 acceptance-failure issue
This commit is contained in:
2026-05-31 17:01:23 +08:00
parent cd721634dd
commit 2ed36c0013
2 changed files with 212 additions and 26 deletions
+34 -26
View File
@@ -3,23 +3,23 @@ name: QE Acceptance Tests
on:
workflow_dispatch:
inputs:
prd_path:
description: 'Path to .docx PRD file (absolute)'
required: false
default: ''
parsed_path:
description: 'Path to pre-parsed _updated.json (skip doc_parser if set)'
required: false
default: ''
acceptance_runs:
description: 'Layer B stability runs (1 = skip stability testing)'
description: 'Layer B stability runs (1 = skip)'
required: false
default: '1'
ir_path:
description: 'Path to IR JSON file (relative to workspace)'
required: false
default: 'output/ir_final.json'
parsed_path:
description: 'Path to _parsed.json or _updated.json (relative to workspace)'
required: false
default: 'output/车机娱乐系统禁止功能文档_精简_updated.json'
jobs:
acceptance:
runs-on: shell
timeout-minutes: 30
timeout-minutes: 60
steps:
- name: Checkout main branch
run: |
@@ -29,26 +29,34 @@ jobs:
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run QE Acceptance Tests
run: >-
python -m pytest tests/acceptance/ -v
--run-acceptance
--acceptance-runs=${{ github.event.inputs.acceptance_runs }}
--ir-path=${{ github.event.inputs.ir_path }}
--parsed-path=${{ github.event.inputs.parsed_path }}
--tb=long
- name: Run pipeline + acceptance tests
run: |
if [ -n "${{ github.event.inputs.prd_path }}" ]; then
python scripts/run_pipeline.py --input "${{ github.event.inputs.prd_path }}" --test
elif [ -n "${{ github.event.inputs.parsed_path }}" ]; then
python scripts/run_pipeline.py --parsed "${{ github.event.inputs.parsed_path }}" --test
else
# No input provided — run acceptance on existing output if present
python -m pytest tests/acceptance/ -v --run-acceptance \
--acceptance-runs=${{ github.event.inputs.acceptance_runs }} --tb=short
fi
env:
DASHSCOPE_API_KEY: ${{ secrets.DASHSCOPE_API_KEY }}
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
- name: Create issue on failure
if: failure()
env:
GITEA_API_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: >-
python scripts/create_failure_issue.py
--sha "${{ github.sha }}"
--branch "main"
--run "${{ github.run_number }}"
--message "QE Acceptance Tests Failed"
--workflow "QE Acceptance"
--labels "acceptance-failure,agent-task"
run: |
# Read acceptance report summary if it exists
if [ -f acceptance-report.json ]; then
SUMMARY=$(python -c "import json; r=json.load(open('acceptance-report.json')); print(r.get('final_verdict','?'))")
DETAILS=$(python -c "import json; r=json.load(open('acceptance-report.json')); fd=r.get('failure_details',[]); print('\\n'.join(f'- {d}' for d in fd) if fd else '')")
fi
python scripts/create_failure_issue.py \
--sha "${{ github.sha }}" --branch "main" \
--run "${{ github.run_number }}" \
--message "QE Acceptance: ${SUMMARY:-pipeline failed}" \
--workflow "QE Acceptance" \
--labels "acceptance-failure,agent-task"