-
Notifications
You must be signed in to change notification settings - Fork 0
271 lines (236 loc) · 8.43 KB
/
deployment-tests.yml
File metadata and controls
271 lines (236 loc) · 8.43 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
name: Deployment Timing Tests
# Tests for LDEV-5478 / LDEV-5960 - deploy folder timing issues
# Verifies that extensions in the deploy folder are fully initialized before requests are served
on:
workflow_dispatch:
push:
branches:
- deployment-tests
paths:
- 'custom/deployment-tests/**'
- '.github/workflows/deployment-tests.yml'
env:
EXPRESS_TEMPLATE_URL: https://cdn.lucee.org/express-templates/lucee-tomcat-11.0.13-template.zip
jobs:
# Build the test extension
build-extensions:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: temurin
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: maven-cache-extensions
- name: Build slow-startup extension
run: |
cd custom/deployment-tests/extensions/slow-startup
mvn package -q
ls -la target/
echo "Extension built:"
unzip -l target/*.lex
- name: Upload slow-startup extension
uses: actions/upload-artifact@v4
with:
name: slow-startup-extension
path: custom/deployment-tests/extensions/slow-startup/target/*.lex
retention-days: 1
# Build Lucee from source (for build-from-source entries)
build-lucee:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: "7.1-native"
repo: "zspitzer/Lucee"
ref: "LDEV-1402-native-debugger"
steps:
- name: Checkout Lucee
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo }}
ref: ${{ matrix.ref }}
path: lucee
- name: Get commit SHA
id: get-commit
run: |
cd lucee
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Cache Lucee JAR
id: cache-lucee
uses: actions/cache@v4
with:
path: lucee-jar/
key: lucee-${{ matrix.name }}-${{ steps.get-commit.outputs.sha }}
- name: Set up JDK 21
if: steps.cache-lucee.outputs.cache-hit != 'true'
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Cache Maven packages
if: steps.cache-lucee.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ~/.m2
key: lucee-maven-${{ hashFiles('lucee/**/pom.xml') }}
restore-keys: lucee-maven-
- name: Build Lucee
if: steps.cache-lucee.outputs.cache-hit != 'true'
run: |
cd lucee/loader
ant fast
mkdir -p ../../lucee-jar
cp target/lucee-*.jar ../../lucee-jar/
- name: Upload Lucee JAR
uses: actions/upload-artifact@v4
with:
name: lucee-${{ matrix.name }}
path: lucee-jar/lucee-*.jar
retention-days: 1
# Test deployment timing
test-deploy-timing:
needs: [build-extensions, build-lucee]
if: always() && needs.build-extensions.result == 'success'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
# Download from CDN
- name: "7.0-stable"
source: "download"
luceeVersion: "7.0/stable/jar"
- name: "6.2-stable"
source: "download"
luceeVersion: "6.2/stable/jar"
# Build from source
- name: "7.1-native"
source: "build"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Download slow-startup extension
uses: actions/download-artifact@v4
with:
name: slow-startup-extension
path: extensions/
- name: Download Lucee Express template
run: |
curl -L -o express-template.zip "$EXPRESS_TEMPLATE_URL"
unzip -q express-template.zip -d express
# Download Lucee JAR from CDN
- name: Download Lucee JAR (from CDN)
if: matrix.source == 'download'
run: |
LUCEE_FILENAME=$(curl -s "https://update.lucee.org/rest/update/provider/latest/${{ matrix.luceeVersion }}/filename" | tr -d '"')
echo "Lucee filename: $LUCEE_FILENAME"
LUCEE_URL="https://cdn.lucee.org/$LUCEE_FILENAME"
echo "Downloading from: $LUCEE_URL"
curl -L -f -o lucee.jar "$LUCEE_URL"
if ! unzip -t lucee.jar > /dev/null 2>&1; then
echo "ERROR: Downloaded JAR is corrupt!"
exit 1
fi
rm -f express/lib/lucee-*.jar
cp lucee.jar express/lib/
# Download Lucee JAR from build artifact
- name: Download Lucee JAR (from build)
if: matrix.source == 'build'
uses: actions/download-artifact@v4
with:
name: lucee-${{ matrix.name }}
path: lucee-jar/
- name: Install built Lucee JAR
if: matrix.source == 'build'
run: |
rm -f express/lib/lucee-*.jar
cp lucee-jar/lucee-*.jar express/lib/
echo "Installed JAR:"
ls -la express/lib/lucee-*.jar
- name: Prepare test environment
run: |
echo "## Test: ${{ matrix.name }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Copy test script to webroot
cp custom/deployment-tests/test-slow-startup.cfm express/webapps/ROOT/
# Copy extension to deploy folder BEFORE starting Lucee
mkdir -p express/lucee-server/deploy/
cp extensions/*.lex express/lucee-server/deploy/
echo "Extension in deploy folder:"
ls -la express/lucee-server/deploy/
# Configure trace logging
echo 'export LUCEE_LOGGING_FORCE_LEVEL=trace' >> express/bin/setenv.sh
chmod +x express/bin/setenv.sh
# Configure Tomcat port
sed -i 's/port="8080"/port="8888"/g' express/conf/server.xml
- name: Start Lucee and test IMMEDIATELY (no sleep!)
id: test
run: |
cd express
echo "Starting Lucee Express..."
./bin/catalina.sh start
echo "Lucee started"
echo "Making immediate request (no delay)..."
# Try up to 60 times with 1 second between attempts
for i in {1..60}; do
echo "Attempt $i..."
HTTP_CODE=$(curl -s -o /tmp/response.txt -w "%{http_code}" http://127.0.0.1:8888/test-slow-startup.cfm 2>/dev/null) || HTTP_CODE="000"
echo "HTTP Code: $HTTP_CODE"
if [ "$HTTP_CODE" != "000" ] && [ -f /tmp/response.txt ]; then
echo "=== Response ==="
cat /tmp/response.txt
echo ""
echo "================"
if [ "$HTTP_CODE" = "200" ]; then
echo "TEST PASSED: Extension ready on first request"
echo "### Result: PASSED" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/response.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit 0
else
echo "TEST FAILED: Extension NOT ready - LDEV-5478 reproduced!"
echo "### Result: FAILED (LDEV-5478 reproduced)" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
cat /tmp/response.txt >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
exit 1
fi
fi
sleep 1
done
echo "TEST INCONCLUSIVE: Tomcat never responded"
echo "### Result: INCONCLUSIVE (Tomcat timeout)" >> $GITHUB_STEP_SUMMARY
exit 1
- name: Stop Lucee
if: always()
run: |
cd express
./bin/shutdown.sh || true
- name: Show catalina.out
if: always()
run: |
echo "=== catalina.out ==="
cat express/logs/catalina.out || echo "No catalina.out found"
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: lucee-logs-${{ matrix.name }}
path: |
express/logs/
express/lucee-server/context/logs/