-
Notifications
You must be signed in to change notification settings - Fork 2
80 lines (68 loc) · 2.61 KB
/
Copy pathsmoke-test.yml
File metadata and controls
80 lines (68 loc) · 2.61 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
# Smoke test: verify the shaded fat jar actually boots with config.yml and serves requests
name: Smoke Test
on:
push:
branches:
- develop
pull_request:
workflow_dispatch:
jobs:
smoke-test:
name: Smoke test runnable jar (Java ${{ matrix.java }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [21, 25]
os: [ubuntu-latest]
distribution: [temurin]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }}
cache: maven
- name: Build fat jar
run: mvn --batch-mode --no-transfer-progress --settings .maven-settings.xml clean package -DskipTests
- name: Smoke test the built jar
run: |
set -euo pipefail
JAR=$(ls target/io.wcm.devops.maven.nodejs-proxy-*.jar | grep -Ev -- '-(sources|javadoc)\.jar$' | head -n1)
echo "Starting built jar: $JAR"
java -jar "$JAR" server config.yml > server.log 2>&1 &
APP_PID=$!
trap 'kill "$APP_PID" 2>/dev/null || true' EXIT
# Wait for the application connector (port 8080) to accept requests.
up=false
for i in $(seq 1 30); do
if curl -sf -o /dev/null http://localhost:8080/; then
up=true
break
fi
if ! kill -0 "$APP_PID" 2>/dev/null; then
echo "::error::Application process exited before becoming ready"
cat server.log
exit 1
fi
sleep 2
done
if [ "$up" != true ]; then
echo "::error::Application did not become ready within timeout"
cat server.log
exit 1
fi
# Index page is served locally (no upstream dependency) -> hard gate.
echo "== GET / (index page) =="
status=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/)
echo "index status: $status"
if [ "$status" != "200" ]; then
echo "::error::Index page returned $status"
cat server.log
exit 1
fi
# Admin health check (hits live nodejs.org) -> reported, not gated.
echo "== GET /healthcheck (admin) =="
curl -s -w '\nhealthcheck status: %{http_code}\n' http://localhost:8081/healthcheck || true
echo "Smoke test passed: jar boots and serves the index page."