-
Notifications
You must be signed in to change notification settings - Fork 27
308 lines (270 loc) · 10.2 KB
/
integration.yml
File metadata and controls
308 lines (270 loc) · 10.2 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
name: Integration
on:
pull_request:
branches: [master, main]
paths:
- 'src/**'
- 'sql/**'
- 'lib/world/**'
- 'scripts/**'
- '.github/workflows/integration.yml'
jobs:
database-migration:
name: Database Migration Dry-Run
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.11
env:
MARIADB_ROOT_PASSWORD: testroot
MARIADB_DATABASE: luminari_test
MARIADB_USER: luminari
MARIADB_PASSWORD: testpass
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Wait for MariaDB
run: |
for i in {1..30}; do
if mysqladmin ping -h 127.0.0.1 -u luminari -ptestpass --silent 2>/dev/null; then
echo "MariaDB is ready"
break
fi
echo "Waiting for MariaDB... ($i/30)"
sleep 2
done
- name: Validate master schema
run: |
if [[ -f sql/master_schema.sql ]]; then
echo "Applying master_schema.sql..."
mysql -h 127.0.0.1 -u luminari -ptestpass luminari_test < sql/master_schema.sql
echo "Master schema applied successfully"
else
echo "::warning::master_schema.sql not found"
fi
- name: Validate component schemas
run: |
FAILED=0
for schema in sql/components/*.sql; do
if [[ -f "$schema" ]]; then
echo "Validating: $schema"
if mysql -h 127.0.0.1 -u luminari -ptestpass luminari_test < "$schema" 2>&1; then
echo " OK: $schema"
else
echo "::warning::Schema validation issue in $schema (may be expected for some migrations)"
fi
fi
done
echo "Schema validation complete"
- name: Verify database structure
run: |
echo "Tables created:"
mysql -h 127.0.0.1 -u luminari -ptestpass luminari_test -e "SHOW TABLES;" | head -50
TABLE_COUNT=$(mysql -h 127.0.0.1 -u luminari -ptestpass luminari_test -N -e "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='luminari_test';")
echo "Total tables: $TABLE_COUNT"
if [[ "$TABLE_COUNT" -gt 0 ]]; then
echo "Database migration dry-run successful"
else
echo "::warning::No tables created - check schema files"
fi
world-validation:
name: World File Validation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Verify minimal world files exist
run: |
echo "Checking minimal world directory..."
if [[ -d lib/world/minimal ]]; then
echo "Minimal world files found:"
ls -la lib/world/minimal/
else
echo "::error::Minimal world directory not found at lib/world/minimal/"
exit 1
fi
- name: Validate world file structure
run: |
ERRORS=0
# Check for required index files
for dir in zon wld mob obj shp trg qst hlq; do
if [[ -f "lib/world/minimal/index.${dir}" ]]; then
echo "Found: index.${dir}"
else
echo "::warning::Missing index file: index.${dir}"
fi
done
# Check zone files are parseable (basic syntax check)
echo "Validating zone file syntax..."
for zonefile in lib/world/minimal/*.zon; do
if [[ -f "$zonefile" ]]; then
# Basic check: zone files should start with zone number or comment
if head -5 "$zonefile" | grep -qE '^[0-9#]'; then
echo " OK: $zonefile"
else
echo "::warning::Possible syntax issue in $zonefile"
fi
fi
done
echo "World file validation complete"
- name: Check world directory structure
run: |
echo "=== World Directory Structure ==="
for dir in zon wld mob obj shp trg qst hlq; do
if [[ -d "lib/world/$dir" ]]; then
count=$(find "lib/world/$dir" -type f 2>/dev/null | wc -l)
echo "$dir: $count files"
else
echo "$dir: directory missing"
fi
done
server-startup:
name: Server Startup Verification
runs-on: ubuntu-latest
needs: [database-migration, world-validation]
services:
mariadb:
image: mariadb:10.11
env:
MARIADB_ROOT_PASSWORD: testroot
MARIADB_DATABASE: luminari_test
MARIADB_USER: luminari
MARIADB_PASSWORD: testpass
ports:
- 3306:3306
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libmariadb-dev libssl-dev zlib1g-dev \
autoconf automake libtool libgd-dev libcurl4-openssl-dev libjson-c-dev netcat-openbsd
- name: Copy config headers
run: |
cp src/campaign.example.h src/campaign.h
cp src/mud_options.example.h src/mud_options.h
cp src/vnums.example.h src/vnums.h
- name: Build server
run: |
autoreconf -fvi
./configure
make -j"$(nproc)"
test -f circle && echo "Build successful: circle binary created"
- name: Wait for MariaDB
run: |
for i in {1..30}; do
if mysqladmin ping -h 127.0.0.1 -u luminari -ptestpass --silent 2>/dev/null; then
echo "MariaDB is ready"
break
fi
echo "Waiting for MariaDB... ($i/30)"
sleep 2
done
- name: Setup database
run: |
if [[ -f sql/master_schema.sql ]]; then
mysql -h 127.0.0.1 -u luminari -ptestpass luminari_test < sql/master_schema.sql
fi
- name: Setup MySQL config
run: |
cat > lib/mysql_config <<EOF
mysql_host = 127.0.0.1
mysql_database = luminari_test
mysql_username = luminari
mysql_password = testpass
EOF
- name: Initialize world data
run: |
# Create world directories
mkdir -p lib/world/{zon,wld,mob,obj,shp,trg,qst,hlq}
# Copy minimal world files
cp lib/world/minimal/index.zon lib/world/zon/index 2>/dev/null || true
cp lib/world/minimal/*.zon lib/world/zon/ 2>/dev/null || true
cp lib/world/minimal/index.wld lib/world/wld/index 2>/dev/null || true
cp lib/world/minimal/*.wld lib/world/wld/ 2>/dev/null || true
cp lib/world/minimal/index.mob lib/world/mob/index 2>/dev/null || true
cp lib/world/minimal/*.mob lib/world/mob/ 2>/dev/null || true
cp lib/world/minimal/index.obj lib/world/obj/index 2>/dev/null || true
cp lib/world/minimal/*.obj lib/world/obj/ 2>/dev/null || true
cp lib/world/minimal/index.shp lib/world/shp/index 2>/dev/null || true
cp lib/world/minimal/index.trg lib/world/trg/index 2>/dev/null || true
cp lib/world/minimal/index.qst lib/world/qst/index 2>/dev/null || true
cp lib/world/minimal/index.hlq lib/world/hlq/index 2>/dev/null || true
echo "World data initialized"
- name: Create required directories
run: |
mkdir -p lib/plrfiles/{A-E,F-J,K-O,P-T,U-Z,ZZZ}
mkdir -p lib/plrobjs/{A-E,F-J,K-O,P-T,U-Z,ZZZ}
mkdir -p lib/house lib/mudmail lib/etc log
- name: Create minimal text files
run: |
mkdir -p lib/text/help
echo "Welcome to LuminariMUD" > lib/text/news
echo "LuminariMUD Credits" > lib/text/credits
echo "Message of the Day" > lib/text/motd
echo "Immortal MOTD" > lib/text/imotd
echo "Welcome" > lib/text/greetings
echo "Help System" > lib/text/help/help
echo '$' > lib/text/help/index
echo "Info" > lib/text/info
echo "Wizlist" > lib/text/wizlist
echo "Immlist" > lib/text/immlist
echo "Policies" > lib/text/policies
echo "Handbook" > lib/text/handbook
echo "Background" > lib/text/background
mkdir -p lib/misc
echo '*' > lib/misc/messages
echo '$' > lib/misc/socials.new
- name: Server startup smoke test
run: |
echo "Starting server for smoke test..."
# Start server in background with timeout
timeout 30s ./circle -q 4100 &
SERVER_PID=$!
# Wait for server to start
sleep 10
# Check if server is still running
if kill -0 $SERVER_PID 2>/dev/null; then
echo "Server started successfully (PID: $SERVER_PID)"
# Try to connect to the port
if nc -z localhost 4100 2>/dev/null; then
echo "Server is accepting connections on port 4100"
else
echo "::warning::Server running but not accepting connections yet"
fi
# Check log for errors
if [[ -f log/syslog ]]; then
echo "=== Recent syslog entries ==="
tail -20 log/syslog
# Check for critical errors
if grep -qi "SYSERR" log/syslog; then
echo "::warning::SYSERR found in logs - check for issues"
fi
fi
# Graceful shutdown
echo "Shutting down server..."
kill $SERVER_PID 2>/dev/null || true
wait $SERVER_PID 2>/dev/null || true
echo "Server startup smoke test PASSED"
else
echo "::error::Server failed to start or crashed"
# Show any logs
if [[ -f log/syslog ]]; then
echo "=== syslog ==="
cat log/syslog
fi
exit 1
fi