# Woodpecker CI/CD 配置 - E2E/UAT测试集成 # 集成Python pytest测试套件 pipeline: # E2E/UAT测试阶段 test-e2e-uat: image: python:3.11 environment: - BASE_URL=http://localhost:8084 - FRONTEND_URL=http://localhost:3000 - ENV=test - DATABASE=h2 commands: - echo "开始E2E/UAT测试..." - cd test-suite - pip install -r requirements.txt - pip install pytest-xdist pytest-rerunfailures - python3 run_tests.py --parallel --reruns 2 --coverage - echo "✅ E2E/UAT测试完成" when: event: [push, pull_request] # 生成测试报告 generate-report: image: python:3.11 commands: - echo "生成测试报告..." - cd test-suite - pip install -r requirements.txt - pip install allure-pytest - pytest tests/ --alluredir=allure-results - echo "✅ 报告生成完成" when: event: [push, pull_request] # 质量门禁 quality-gates: image: python:3.11 commands: - echo "开始质量门禁检查..." - cd test-suite - pip install -r requirements.txt - pytest tests/ --cov=. --cov-report=term-missing --cov-fail-under=80 - echo "✅ 质量门禁检查通过" when: event: [pull_request] # 工作流配置 workflows: # 开发分支工作流 develop: when: event: [push] branch: [develop] steps: - test-e2e-uat - generate-report # 主分支工作流 main: when: event: [push] branch: [main] steps: - test-e2e-uat - quality-gates - generate-report # Pull Request工作流 pull-request: when: event: [pull_request] steps: - test-e2e-uat - quality-gates # 通知配置 notifications: slack: webhook: ${SLACK_WEBHOOK_URL} channel: '#ci-cd' on_success: true on_failure: true # 环境变量 environment: - PYTHONUNBUFFERED=1 - PYTHONDONTWRITEBYTECODE=1 # 缓存配置 cache: paths: - ~/.pip/cache - test-suite/.pytest_cache