Files
novalon-manage-system/.woodpecker.yml
T
张翔 c50ccd258f feat: 重构测试框架并优化代码结构
refactor(tests): 将e2e_tests迁移到tests_suite和api_integration_tests
style: 为Java类添加文档注释
docs: 更新.gitignore和配置文件
test: 添加性能测试和Playwright测试脚本
chore: 清理旧测试文件和配置
2026-03-14 13:49:39 +08:00

160 lines
4.0 KiB
YAML

pipeline:
build:
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api
- mvn clean install -DskipTests -B
package:
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api
- mvn package -DskipTests -B
depends_on:
- build
docker-build-gateway:
image: docker:latest
commands:
- cd novalon-manage-api/manage-gateway
- docker build -t novalon/manage-gateway:${CI_COMMIT_SHA:0:8} .
- docker tag novalon/manage-gateway:${CI_COMMIT_SHA:0:8} novalon/manage-gateway:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- package
docker-build-app:
image: docker:latest
commands:
- cd novalon-manage-api/manage-app
- docker build -t novalon/manage-app:${CI_COMMIT_SHA:0:8} .
- docker tag novalon/manage-app:${CI_COMMIT_SHA:0:8} novalon/manage-app:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
- package
deploy-staging:
image: alpine:latest
commands:
- echo "Deploying to staging environment"
- echo "Branch: ${CI_COMMIT_BRANCH}"
- echo "Commit: ${CI_COMMIT_SHA}"
secrets: [ staging_ssh_key ]
when:
- event: push
branch: develop
depends_on:
- docker-build-gateway
- docker-build-app
deploy-production:
image: alpine:latest
commands:
- echo "Deploying to production environment"
- echo "Branch: ${CI_COMMIT_BRANCH}"
- echo "Commit: ${CI_COMMIT_SHA}"
secrets: [ production_ssh_key ]
when:
- event: push
branch: main
depends_on:
- docker-build-gateway
- docker-build-app
# ========== 阶段1:快速反馈(提交时) ==========
# 后端单元测试(在novalon-manage-api项目中运行)
backend-unit-test:
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api
- mvn test -B
depends_on:
- build
when:
- event: push
# 前端单元测试(在novalon-manage-web项目中运行)
frontend-unit-test:
image: node:20
commands:
- cd novalon-manage-web
- npm install
- npm run test:unit
when:
- event: push
# ========== 阶段2:全面验证(合并前) ==========
# 集成测试(在tests_suite中运行)
integration-test:
image: python:3.13
commands:
- cd tests_suite
- pip install -r requirements.txt
- playwright install chromium
- pytest tests/integration/ -v --tb=short --no-cov
depends_on:
- build
when:
- event: pull_request
# E2E测试(在tests_suite中运行)
e2e-test:
image: python:3.13
commands:
- cd tests_suite
- pip install -r requirements.txt
- playwright install chromium
- pytest tests/e2e/ -v --tb=short --no-cov
depends_on:
- deploy-staging
when:
- event: pull_request
# ========== 阶段3:生产验证(部署前) ==========
# 性能测试(在tests_suite中运行)
performance-test:
image: python:3.13
commands:
- cd tests_suite
- pip install -r requirements.txt
- pytest tests/performance/ -v --no-cov
depends_on:
- deploy-staging
when:
- event: tag
# 安全测试(在tests_suite中运行)
security-test:
image: python:3.13
commands:
- cd tests_suite
- pip install -r requirements.txt
- pytest tests/security/ -v --no-cov
depends_on:
- deploy-staging
when:
- event: deployment
notify:
image: plugins/slack
settings:
webhook: ${SLACK_WEBHOOK}
channel: ci-cd
username: woodpecker
icon_url: https://woodpecker-ci.org/img/logo.svg
when:
- status: [ success, failure ]
depends_on:
- build
- test
- package
- backend-unit-test
- frontend-unit-test
- integration-test
- e2e-test
- performance-test
- security-test
- deploy-staging
- deploy-production