Add spring-boot-product-catalog sample (Spring Boot + PostgreSQL) #1
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
| # spring-boot-product-catalog sample CI — build + end-to-end smoke test. | |
| # | |
| # Scoped with `paths:` to this sample only, so unrelated samples don't pay for | |
| # it (same convention as restheart-mongo.yml). Deliberately Keploy-independent: | |
| # record/replay needs eBPF privileges that are awkward on hosted runners, so CI | |
| # proves the app builds and serves the traffic the recorded suite was captured | |
| # from. The committed test set under keploy/products-crud/ is the regression | |
| # gate, exercised locally and in the Keploy pipelines. | |
| name: spring-boot-product-catalog sample | |
| on: | |
| pull_request: | |
| paths: | |
| - 'spring-boot-product-catalog/**' | |
| - '.github/workflows/spring-boot-product-catalog.yml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'spring-boot-product-catalog/**' | |
| - '.github/workflows/spring-boot-product-catalog.yml' | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: spring-boot-product-catalog-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: build (JDK 21) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| working-directory: spring-boot-product-catalog | |
| run: ./mvnw -B -DskipTests clean package | |
| smoke: | |
| name: end-to-end smoke test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Start app + Postgres | |
| working-directory: spring-boot-product-catalog | |
| run: docker compose up -d --build --wait | |
| - name: Drive the recorded workload | |
| working-directory: spring-boot-product-catalog | |
| run: ./seed.sh | |
| - name: Assert the catalog responds | |
| working-directory: spring-boot-product-catalog | |
| run: | | |
| set -Eeuo pipefail | |
| curl -fsS http://localhost:8080/api/products >/dev/null | |
| curl -fsS http://localhost:8080/api/products/summary >/dev/null | |
| # The 404 path must stay a clean 404, not a 500 — the recorded suite | |
| # asserts the structured error body. | |
| code=$(curl -s -o /dev/null -w '%{http_code}' http://localhost:8080/api/products/99999) | |
| [ "$code" = "404" ] || { echo "::error::expected 404 for a missing product, got $code"; exit 1; } | |
| echo "OK — catalog, summary, and not-found paths all behave." | |
| - name: Dump app logs on failure | |
| if: failure() | |
| working-directory: spring-boot-product-catalog | |
| run: docker compose logs --no-color app | |
| - name: Tear down | |
| if: always() | |
| working-directory: spring-boot-product-catalog | |
| run: docker compose down -v |