-
Notifications
You must be signed in to change notification settings - Fork 47
Add fast post-merge gateway integration check #1126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why rename?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this to run Postgres not in PR, but after PR merge? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,25 +1,58 @@ | ||
| name: Gateway Integration Test (Postgres) | ||
| name: Gateway Post-Merge Integration Check | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'gateway/**' | ||
| - '.github/workflows/gateway-integration-test-postgres.yml' | ||
| - "gateway/**" | ||
| - "tests/mock-servers/**" | ||
| - "samples/sample-service/**" | ||
| - ".github/workflows/gateway-post-merge-integration-check.yml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: gateway-post-merge-it-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| integration-test: | ||
| runs-on: ubuntu-24.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - mode: normal | ||
| compose_file: docker-compose.test.yaml | ||
| suffix: normal | ||
| - mode: postgres | ||
| compose_file: docker-compose.test.postgres.yaml | ||
| suffix: postgres | ||
| env: | ||
| BUILDX_CACHE_ARGS: >- | ||
| --cache-from type=gha,scope=gateway-it-${{ matrix.mode }} | ||
| --cache-to type=gha,mode=max,scope=gateway-it-${{ matrix.mode }} | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.25' | ||
| go-version: "1.25" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result:
Sources: [1] Go blog announcement, [2] Go release history, [3] Official downloads page. 🏁 Script executed: cat -n .github/workflows/gateway-post-merge-integration-check.ymlRepository: wso2/api-platform Length of output: 6880 Fix container name in postgres verification step (line 96). When Additionally, the two "Run integration tests" steps (lines 107–118) are identical except for their conditions; consolidate into a single step. 🤖 Prompt for AI Agents |
||
| cache: true | ||
| cache-dependency-path: | | ||
| go.work.sum | ||
| gateway/gateway-controller/go.sum | ||
| gateway/gateway-builder/go.sum | ||
| gateway/gateway-runtime/policy-engine/go.sum | ||
| gateway/it/go.sum | ||
| gateway/system-policies/analytics/go.sum | ||
| gateway/sample-policies/count-letters/go.sum | ||
| gateway/sample-policies/uppercase-body/go.sum | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
@@ -36,7 +69,16 @@ jobs: | |
| 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: Record test start time | ||
| run: echo "TEST_START_TS=$(date +%s)" >> "$GITHUB_ENV" | ||
|
|
||
| - name: Verify gateway-controller uses PostgreSQL | ||
| if: matrix.mode == 'postgres' | ||
| run: | | ||
| set -euo pipefail | ||
| cd gateway/it | ||
|
|
@@ -62,24 +104,43 @@ jobs: | |
| 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 | ||
| - name: Run integration tests (normal) | ||
| if: matrix.mode == 'normal' | ||
| run: | | ||
| cd gateway | ||
| COMPOSE_FILE=docker-compose.test.postgres.yaml make test-integration | ||
| COMPOSE_FILE=${{ matrix.compose_file }} make test-integration | ||
|
|
||
| - name: Run integration tests (postgres) | ||
| if: matrix.mode == 'postgres' | ||
| run: | | ||
| cd gateway | ||
| COMPOSE_FILE=${{ matrix.compose_file }} make test-integration | ||
|
|
||
| - name: Publish test duration metrics | ||
| if: always() | ||
| run: | | ||
| end_ts="$(date +%s)" | ||
| start_ts="${TEST_START_TS:-$end_ts}" | ||
| duration="$((end_ts - start_ts))" | ||
| minutes="$((duration / 60))" | ||
| seconds="$((duration % 60))" | ||
| echo "### Gateway integration timing" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "- Mode: \`${{ matrix.mode }}\`" >> "$GITHUB_STEP_SUMMARY" | ||
| echo "- Duration: ${minutes}m ${seconds}s (${duration}s)" >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| - name: Upload coverage report | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: coverage-report-postgres | ||
| name: coverage-report-${{ matrix.suffix }} | ||
| path: gateway/it/coverage/output | ||
| retention-days: 7 | ||
|
|
||
| - name: Upload test reports | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-reports-postgres | ||
| name: test-reports-${{ matrix.suffix }} | ||
| path: gateway/it/reports/ | ||
| retention-days: 7 | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: wso2/api-platform
Length of output: 43
Remove the stale path filter entry for
gateway-integration-test-postgres.yml.The referenced workflow file does not exist, so this path filter will never trigger. Either restore the postgres integration workflow file or remove this entry from the filter.
🤖 Prompt for AI Agents