Skip to content

Commit 84d0ec4

Browse files
feat: simplify env handling
1 parent dcaf12d commit 84d0ec4

1 file changed

Lines changed: 18 additions & 36 deletions

File tree

.github/workflows/webapp-e2e-tests-on-demand.yml

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717

1818
permissions:
1919
contents: read
20-
actions: write # Needed for upload-artifact@v4
20+
actions: write # Needed for upload-artifact@v4
2121

2222
jobs:
2323
generate-matrix:
@@ -68,26 +68,9 @@ jobs:
6868
echo "CONFIG_PATH=${{ matrix.config_path }}" >> "$GITHUB_ENV"
6969
echo "NON_STANDALONE=${{ matrix.non_standalone }}" >> "$GITHUB_ENV"
7070
echo "Load environment variables from config path..."
71-
ENV_FILE_ABS="$GITHUB_WORKSPACE/${{ matrix.config_path }}/env"
72-
ENV_FILE_REL="env"
73-
if [[ -f "$ENV_FILE_ABS" ]]; then
74-
if [[ ! -f "${{ matrix.config_path }}/.env" ]]; then
75-
echo "Creating .env from env in ${{ matrix.config_path }}"
76-
cp "$ENV_FILE_ABS" "$GITHUB_WORKSPACE/${{ matrix.config_path }}/.env"
77-
fi
78-
else
79-
ENV_FILE_ABS="$GITHUB_WORKSPACE/${{ matrix.config_path }}/envs/.env.database.elasticsearch"
80-
ENV_FILE_REL="envs/.env.database.elasticsearch"
81-
if [[ -f "$ENV_FILE_ABS" ]]; then
82-
echo "Using env file for 8.8/8.9: $ENV_FILE_ABS"
83-
echo "DATABASE=elasticsearch" >> "$GITHUB_ENV"
84-
else
85-
echo "No env file found in ${{ matrix.config_path }}"
86-
exit 1
87-
fi
88-
fi
89-
echo "ENV_FILE_ABS=$ENV_FILE_ABS" >> "$GITHUB_ENV"
90-
echo "ENV_FILE_REL=$ENV_FILE_REL" >> "$GITHUB_ENV"
71+
if [[ ! -f "${{ matrix.config_path }}/.env" ]]; then
72+
echo "Creating .env from env in ${{ matrix.config_path }}"
73+
cp "${{ matrix.config_path }}/env" "${{ matrix.config_path }}/.env"
9174
# Filter out comments and empty lines before adding to GITHUB_ENV
9275
grep -v '^#' "$ENV_FILE_ABS" | grep -v '^$' >> "$GITHUB_ENV"
9376
echo "=== Loaded environment variables ==="
@@ -133,13 +116,13 @@ jobs:
133116
CAMUNDA_SECURITY_AUTHENTICATION_UNPROTECTEDAPI=true \
134117
CAMUNDA_SECURITY_AUTHORIZATIONS_ENABLED=false \
135118
CAMUNDA_SECURITY_AUTHENTICATION_METHOD=NONE \
136-
DATABASE=elasticsearch docker compose up -d camunda
119+
DATABASE=elasticsearch docker compose --env-file "$ENV_FILE_REL" up -d camunda
137120
else
138121
echo "Starting with default Tasklist V2 mode"
139122
CAMUNDA_SECURITY_AUTHENTICATION_UNPROTECTEDAPI=true \
140123
CAMUNDA_SECURITY_AUTHORIZATIONS_ENABLED=false \
141124
CAMUNDA_SECURITY_AUTHENTICATION_METHOD=NONE \
142-
DATABASE=elasticsearch docker compose up -d camunda
125+
DATABASE=elasticsearch docker compose --env-file "$ENV_FILE_REL" up -d camunda
143126
fi
144127
fi
145128
working-directory: ${{ env.CONFIG_PATH }}
@@ -205,7 +188,7 @@ jobs:
205188
node-version: 22
206189
cache: npm
207190
env:
208-
ACTIONS_STEP_DEBUG: 'false'
191+
ACTIONS_STEP_DEBUG: "false"
209192

210193
- name: Clean install dependencies
211194
shell: bash
@@ -260,34 +243,33 @@ jobs:
260243
- name: Start webserver and run E2E tests
261244
shell: bash
262245
env:
263-
264246
CAMUNDA_TASKLIST_V2_MODE_ENABLED: ${{ matrix.tasklist_mode == 'v2' && 'true' || 'false' }}
265247
run: |
266248
set -euo pipefail
267249
echo "Starting local webserver with debug output..."
268-
250+
269251
# Ensure node_modules/.bin is in PATH for npm-run-all to find binaries
270252
export PATH="$PWD/node_modules/.bin:$PATH"
271-
253+
272254
# Create logs directory in workspace for act compatibility
273255
mkdir -p ./logs
274-
256+
275257
# Start router in background with full output capture
276258
# Use :ci variant to disable livereload and avoid port conflicts
277259
npm run start:local:ci > ./logs/web.log 2>&1 &
278260
WEB_PID=$!
279261
echo $WEB_PID > ./logs/web.pid
280262
echo "Webserver PID: $WEB_PID"
281263
sleep 15
282-
264+
283265
# Check if process is still alive
284266
if ! kill -0 $WEB_PID 2>/dev/null; then
285267
echo "ERROR: Webserver crashed!"
286268
echo "=== Last 150 lines from web.log ==="
287269
tail -n 150 ./logs/web.log || true
288270
exit 1
289271
fi
290-
272+
291273
# Poll for server readiness with longer timeout
292274
echo "Polling for server readiness..."
293275
for i in {1..60}; do
@@ -304,7 +286,7 @@ jobs:
304286
echo "Wait $i/60..."
305287
sleep 2
306288
done
307-
289+
308290
# Verify server is responsive
309291
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:5001/app/index.html 2>/dev/null || echo "000")
310292
if [[ "$HTTP_CODE" == "000" ]]; then
@@ -319,14 +301,14 @@ jobs:
319301
exit 1
320302
fi
321303
echo "✓ Server is ready!"
322-
304+
323305
# Log Camunda container status
324306
echo ""
325307
echo "=== Camunda Container Status ==="
326308
docker ps | grep camunda || echo "Camunda container not found"
327309
docker logs camunda 2>&1 | tail -n 20 || echo "Could not get Camunda logs"
328310
echo ""
329-
311+
330312
# Test Zeebe connectivity
331313
echo "=== Testing Zeebe Connectivity ==="
332314
timeout 5 bash -c 'echo > /dev/tcp/127.0.0.1/26500' && echo "✓ Port 26500 is open" || echo "✗ Port 26500 is closed"
@@ -366,10 +348,10 @@ jobs:
366348
sleep 2
367349
done
368350
echo ""
369-
351+
370352
# Deploy forms before tests (continue even if some forms fail)
371353
npm run e2e:test:deployForms || true
372-
354+
373355
echo ""
374356
echo "=== Starting Playwright E2E Tests with Debug Info ==="
375357
npm run e2e:test 2>&1 | tee -a ./logs/test-output.log || true
@@ -393,4 +375,4 @@ jobs:
393375
fiori-app/webapp/test-results
394376
logs/web.log
395377
logs/test-output.log
396-
retention-days: 10
378+
retention-days: 10

0 commit comments

Comments
 (0)