test/user-journey #3

Merged
zhangxiang merged 142 commits from test/user-journey into dev 2026-04-12 13:17:03 +08:00
Showing only changes of commit f1ff06d268 - Show all commits
+20 -63
View File
@@ -16,7 +16,7 @@
#
# 3. release/** 分支:生产环境代码
# - 触发:push
# - 执行:代码检查 + 构建产物 + 同步部署
# - 执行:代码检查 + 构建部署一体化
# - 部署到:生产环境(139.155.109.62)
# - 归档到:main分支
#
@@ -27,11 +27,10 @@
# 流水线阶段:
# 阶段0: 依赖安装(统一缓存)
# 阶段1: 并行代码质量检查 (lint, type-check, security-scan)
# 阶段2: 单元测试 -> E2E测试 (允许失败)
# 阶段3: 构建生产产物 (release分支)
# 阶段4: 同步产物到生产服务器并部署 (release分支)
# 阶段5: 归档到main分支 (仅release分支)
# 阶段6: 企业微信通知
# 阶段2: 测试 (unit-tests, e2e-tests - 仅dev分支)
# 阶段3: 构建并部署到生产环境 (release分支,一体化)
# 阶段4: 归档到main分支 (release分支)
# 阶段5: 企业微信通知
# ============================================
variables:
@@ -54,11 +53,6 @@ steps:
event:
- push
- pull_request
branch:
- feature/**
- dev
- release
- release/**
# ============================================
# 阶段1: 并行代码质量检查
@@ -78,11 +72,6 @@ steps:
event:
- push
- pull_request
branch:
- feature/**
- dev
- release
- release/**
type-check:
image: *node_image
@@ -99,11 +88,6 @@ steps:
event:
- push
- pull_request
branch:
- feature/**
- dev
- release
- release/**
security-scan:
image: *node_image
@@ -121,11 +105,6 @@ steps:
event:
- push
- pull_request
branch:
- feature/**
- dev
- release
- release/**
# ============================================
# 阶段2: 测试 (仅dev分支,允许失败)
@@ -177,44 +156,25 @@ steps:
- dev
# ============================================
# 阶段3: 构建生产产物 (release分支)
# 阶段3: 构建并部署到生产环境 (release分支)
# ============================================
build-artifacts:
build-and-deploy:
image: *node_image
environment:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: 1
SSH_PRIVATE_KEY:
from_secret: ssh_private_key
depends_on:
- lint
- type-check
commands:
- echo "Building production artifacts..."
- echo "=== Step 1: 构建生产产物 ==="
- npm run build
- echo "✅ Build completed"
- echo "✅ 构建完成"
- ls -la dist/
volumes:
- /tmp/npm-cache:/root/.npm
- /tmp/node-modules-cache:/woodpecker/src/node_modules
when:
event:
- push
branch:
- release
- release/**
# ============================================
# 阶段4: 部署到生产环境 (release分支)
# ============================================
deploy-production:
image: alpine/git:latest
environment:
DEPLOY_ENV: production
SSH_PRIVATE_KEY:
from_secret: ssh_private_key
depends_on:
- build-artifacts
commands:
- echo "Deploying to production environment..."
- echo "=== Step 2: 部署到生产环境 ==="
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
@@ -244,7 +204,10 @@ steps:
chmod +x scripts/deploy-production.sh
./scripts/deploy-production.sh
EOF
- echo "✅ Production deployment completed!"
- echo "✅ 生产环境部署完成!"
volumes:
- /tmp/npm-cache:/root/.npm
- /tmp/node-modules-cache:/woodpecker/src/node_modules
when:
event:
- push
@@ -253,7 +216,7 @@ steps:
- release/**
# ============================================
# 阶段5: 归档到main分支 (release分支)
# 阶段4: 归档到main分支 (release分支)
# ============================================
archive-to-main:
image: alpine/git:latest
@@ -261,7 +224,7 @@ steps:
SSH_PRIVATE_KEY:
from_secret: ssh_private_key
depends_on:
- deploy-production
- build-and-deploy
commands:
- echo "Archiving to main branch..."
- mkdir -p ~/.ssh
@@ -303,11 +266,9 @@ steps:
branch:
- release
- release/**
status:
- success
# ============================================
# 阶段6: 企业微信通知
# 阶段5: 企业微信通知
# ============================================
notify-wechat-success:
image: curlimages/curl:latest
@@ -324,8 +285,6 @@ steps:
branch:
- release
- release/**
status:
- success
notify-wechat-failure:
image: curlimages/curl:latest
@@ -333,7 +292,7 @@ steps:
WECHAT_WEBHOOK:
from_secret: wechat_webhook
depends_on:
- deploy-production
- build-and-deploy
commands:
- sh scripts/notify-wechat.sh failure
when:
@@ -342,8 +301,6 @@ steps:
branch:
- release
- release/**
status:
- failure
workspace:
base: /woodpecker