Update actions/setup-java digest to 03ad4de #48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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." |