Repository navigation
132 lines (112 loc) · 3.3 KB
/
Copy pathci.yml
File metadata and controls
132 lines (112 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
on:
push:
branches: [develop, master]
pull_request:
branches: [develop, master]
jobs:
build:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0.33
env:
MYSQL_ROOT_PASSWORD: 123455
MYSQL_DATABASE: mes_db
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Set up Node.js 20
uses: actions/setup-node@v7
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: mes-frontend/package-lock.json
- name: Build with Maven
run: mvn clean package -q
env:
MYSQL_HOST: localhost
MYSQL_PORT: 3306
MYSQL_USERNAME: root
MYSQL_PASSWORD: 123455
LOG_LEVEL: warn
- name: Initialize Database Schema
run: |
sudo apt-get update && sudo apt-get install -y mysql-client >/dev/null 2>&1
mysql -h 127.0.0.1 -P 3306 -uroot -p123455 --default-character-set=utf8mb4 mes_db < sql/init.sql
mysql -h 127.0.0.1 -P 3306 -uroot -p123455 -e "SELECT COUNT(*) AS users FROM mes_db.sys_user"
- name: Install Frontend Dependencies
run: |
cd mes-frontend
npm ci
- name: Lint Frontend
run: |
cd mes-frontend
npm run lint
- name: Type Check Frontend
run: |
cd mes-frontend
npm run type-check
- name: Unit Test Frontend (vitest)
run: |
cd mes-frontend
npm test
- name: Build Frontend
run: |
cd mes-frontend
npm run build
# 真实启动后端服务验证(防止"编译通过但运行时挂掉",例如依赖缺失、Bean 初始化失败、权限链断裂)
# 注:mes-dashboard 依赖 InfluxDB/Kafka,未纳入本次冒烟
smoke:
name: Backend smoke test (真实启动 + 认证链路)
needs: build
runs-on: ubuntu-latest
timeout-minutes: 15
services:
mysql:
image: mysql:8.0.33
env:
MYSQL_ROOT_PASSWORD: 123455
MYSQL_DATABASE: mes_db
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v7
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Package backend
run: mvn clean package -DskipTests -q
- name: Install mysql client
run: sudo apt-get update && sudo apt-get install -y mysql-client >/dev/null 2>&1
- name: Smoke test
run: bash scripts/ci-smoke.sh