Generate build.yaml for ap gateway image build command #142
Workflow file for this run
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
| name: Gateway Integration Test (Postgres) | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'gateway/**' | |
| - '.github/workflows/gateway-integration-test-postgres.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| integration-test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.25' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build coverage-instrumented images | |
| run: | | |
| cd gateway | |
| make build-coverage VERSION=test | |
| - name: Build mock server images | |
| run: | | |
| for mock in mock-jwks mock-azure-content-safety mock-aws-bedrock-guardrail mock-embedding-provider mock-analytics-collector; do | |
| echo "Building $mock..." | |
| docker build -t ghcr.io/wso2/api-platform/$mock:latest tests/mock-servers/$mock | |
| done | |
| - name: Build sample-service | |
| run: | | |
| cd samples/sample-service | |
| make build | |
| - name: Verify gateway-controller uses PostgreSQL | |
| run: | | |
| set -euo pipefail | |
| cd gateway/it | |
| PROJECT="gateway-it-postgres-verify" | |
| cleanup() { | |
| docker compose -p "$PROJECT" -f docker-compose.test.postgres.yaml down -v --remove-orphans || true | |
| } | |
| trap cleanup EXIT | |
| docker compose -p "$PROJECT" -f docker-compose.test.postgres.yaml up -d postgres gateway-controller | |
| timeout 90 bash -c 'until curl -fsS http://localhost:9090/health >/dev/null; do sleep 2; done' | |
| docker logs it-gateway-controller > /tmp/gateway-controller.log 2>&1 || true | |
| grep -Eq "Initializing PostgreSQL storage|PostgreSQL schema up to date" /tmp/gateway-controller.log | |
| schema_count="$(docker compose -p "$PROJECT" -f docker-compose.test.postgres.yaml exec -T postgres \ | |
| psql -U gateway -d gateway_test -tAc "SELECT COUNT(*) FROM schema_migrations WHERE id = 1 AND version >= 1;")" | |
| [ "$schema_count" = "1" ] | |
| conn_count="$(docker compose -p "$PROJECT" -f docker-compose.test.postgres.yaml exec -T postgres \ | |
| psql -U gateway -d gateway_test -tAc "SELECT COUNT(*) FROM pg_stat_activity WHERE application_name = 'gateway-controller';")" | |
| [ "${conn_count:-0}" -ge 1 ] | |
| - name: Run integration tests | |
| run: | | |
| cd gateway | |
| COMPOSE_FILE=docker-compose.test.postgres.yaml make test-integration | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-report-postgres | |
| path: gateway/it/coverage/output | |
| retention-days: 7 | |
| - name: Upload test reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-reports-postgres | |
| path: gateway/it/reports/ | |
| retention-days: 7 | |
| - name: Debug on failure - Dump logs | |
| if: failure() | |
| run: | | |
| echo "=== Docker Containers ===" | |
| docker ps -a | |
| echo "" | |
| echo "=== gateway/it/logs Directory Contents ===" | |
| if [ -d gateway/it/logs ]; then | |
| if [ "$(ls -A gateway/it/logs)" ]; then | |
| for f in gateway/it/logs/*; do | |
| echo "" | |
| echo "--- Contents of $f ---" | |
| cat "$f" | |
| done | |
| else | |
| echo "No log files found in gateway/it/logs." | |
| fi | |
| else | |
| echo "Directory gateway/it/logs does not exist." | |
| fi |