Files
novalon-manage-system/.woodpecker.yml
T
张翔 9f8bf041c3 feat: 更新端口配置并添加监控支持
fix: 修复测试配置和依赖检查

perf: 优化雪花算法性能

refactor: 清理冗余代码和未使用的导入

style: 统一代码格式和注释

test: 添加单元测试和集成测试

ci: 更新CI配置和构建脚本

chore: 更新依赖和配置文件
2026-03-13 08:50:19 +08:00

156 lines
3.9 KiB
YAML

pipeline:
name: Novalon Manage System CI/CD
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
variables:
DOCKER_REGISTRY: registry.example.com
DOCKER_IMAGE: novalon-manage-system
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: manage_system
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 55432:5432
steps:
- name: Backend Build
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api
- mvn clean compile -DskipTests
when:
event: [push, pull_request]
path: novalon-manage-api/**
- name: Backend Test
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api
- mvn verify
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/manage_system
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
when:
event: [push, pull_request]
path: novalon-manage-api/**
- name: Backend Coverage Report
image: maven:3.9-eclipse-temurin-21
commands:
- cd novalon-manage-api/manage-sys
- echo "Coverage report generated at target/site/jacoco/index.html"
when:
event: [push, pull_request]
path: novalon-manage-api/**
- name: Frontend Install
image: node:21-alpine
commands:
- cd novalon-manage-web
- npm ci
when:
event: [push, pull_request]
path: novalon-manage-web/**
- name: Frontend Build
image: node:21-alpine
commands:
- cd novalon-manage-web
- npm run build
when:
event: [push, pull_request]
path: novalon-manage-web/**
- name: Frontend Test
image: node:21-alpine
commands:
- cd novalon-manage-web
- npm run test
when:
event: [push, pull_request]
path: novalon-manage-web/**
- name: E2E Test Setup
image: python:3.13-alpine
commands:
- cd e2e_tests
- pip install -r requirements.txt
when:
event: [push, pull_request]
path: e2e_tests/**
- name: Start Backend
image: docker:dind
commands:
- cd novalon-manage-api
- docker build -t novalon-manage-api .
- docker run -d --name backend -p 8080:8080 --network host novalon-manage-api
detach: true
when:
event: [push, pull_request]
path: novalon-manage-api/** or e2e_tests/**
- name: Run E2E Tests
image: python:3.13-alpine
commands:
- cd e2e_tests
- pytest tests/ -v --cov=. --cov-report=xml --cov-report=html
environment:
API_BASE_URL: http://backend:8080
DATABASE_HOST: postgres
DATABASE_PORT: 5432
DATABASE_NAME: manage_system
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
when:
event: [push, pull_request]
path: e2e_tests/**
- name: Code Coverage Report
image: plugins/coverage
settings:
server: https://coverage.example.com
token: ${COVERAGE_TOKEN}
when:
event: [push, pull_request]
path: e2e_tests/**
- name: Build Docker Image
image: docker:dind
commands:
- docker build -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${CI_COMMIT_SHA:0:8} -t ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest .
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:${CI_COMMIT_SHA:0:8}
- docker push ${DOCKER_REGISTRY}/${DOCKER_IMAGE}:latest
when:
branch: [main, develop]
event: push
- name: Deploy to Staging
image: alpine:latest
commands:
- echo "Deploying to staging environment"
- sh deploy-staging.sh
secrets: [ staging_ssh_key, staging_host ]
when:
branch: [develop]
event: push
- name: Deploy to Production
image: alpine:latest
commands:
- echo "Deploying to production environment"
- sh deploy-production.sh
secrets: [ production_ssh_key, production_host ]
when:
branch: [main]
event: push