-
Notifications
You must be signed in to change notification settings - Fork 0
refactor(test): consolidate testing infrastructure with Docker Compose #41
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
Merged
+2,976
−2,617
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| name: Logs | ||
| description: Display container logs on test failure | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Display container logs on failure | ||
| if: failure() | ||
| shell: bash | ||
| run: | | ||
| echo "=== Listing all Docker containers ===" | ||
| docker ps -a --filter "name=sq-test-" || true | ||
| echo "" | ||
| echo "=== Dumping container logs ===" | ||
| for container in $(docker ps -a --filter "name=sq-test-" --format "{{.Names}}"); do | ||
| echo ">>> Logs for $container <<<" | ||
| docker logs "$container" 2>&1 || true | ||
| echo "" | ||
| done |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| name: Run Bazel Test | ||
| description: Run Bazel test and show logs on failure | ||
|
|
||
| inputs: | ||
| target: | ||
| description: Bazel test target pattern | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Run Bazel test | ||
| shell: bash | ||
| run: ./tool/bazel test ${{ inputs.target }} --test_output=errors | ||
|
|
||
| - uses: ./.github/actions/logs | ||
| if: always() |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: Setup | ||
| description: Setup Bazel cache for CI jobs | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Setup Bazel cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| ~/.cache/bazel | ||
| ~/.cache/bazelisk | ||
| key: bazel-${{ runner.os }}-${{ hashFiles('MODULE.bazel', 'go.mod', '.bazelversion') }} | ||
| restore-keys: | | ||
| bazel-${{ runner.os }}- | ||
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
|
|
||
| jobs: | ||
| # --------------------------------------------------------------------------- | ||
| # BUILD AND UNIT TESTS (special case - Gazelle + build + unit tests) | ||
| # --------------------------------------------------------------------------- | ||
| build-and-unit-test: | ||
| name: Build and Unit Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
|
|
||
| - name: Check BUILD files are up to date | ||
| run: | | ||
| echo "Running Gazelle to check BUILD files..." >&2 | ||
| make gazelle | ||
| if ! git diff --quiet; then | ||
| echo "BUILD files are out of date!" >&2 | ||
| echo "" >&2 | ||
| echo "The following files were modified by Gazelle:" >&2 | ||
| git diff --name-only >&2 | ||
| echo "" >&2 | ||
| echo "Please run 'make gazelle' locally and commit the changes." >&2 | ||
| exit 1 | ||
| fi | ||
| echo "BUILD files are up to date" >&2 | ||
|
|
||
| - name: Build project | ||
| run: make build | ||
|
|
||
| - name: Run unit tests | ||
| run: make test || echo "No unit tests found" | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # INTEGRATION TESTS (e2e, gateway, orchestrator) | ||
| # --------------------------------------------------------------------------- | ||
| e2e: | ||
| name: E2E Integration Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
|
|
||
| - name: Run E2E tests | ||
| run: make e2e-test | ||
|
|
||
| - uses: ./.github/actions/logs | ||
|
|
||
| gateway-integration-test: | ||
| name: Gateway Integration Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
|
|
||
| - name: Run Gateway integration tests | ||
| run: make integration-test-gateway | ||
|
|
||
| - uses: ./.github/actions/logs | ||
|
|
||
| orchestrator-integration-test: | ||
| name: Orchestrator Integration Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
|
|
||
| - name: Run Orchestrator integration tests | ||
| run: make integration-test-orchestrator | ||
|
|
||
| - uses: ./.github/actions/logs | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # EXTENSION TESTS | ||
| # --------------------------------------------------------------------------- | ||
| counter-integration-test: | ||
| name: Counter Extension Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
| - uses: ./.github/actions/run-bazel-test | ||
| with: | ||
| target: //test/integration/extension/counter/... | ||
|
|
||
| queue-integration-test: | ||
| name: Queue Extension Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
| - uses: ./.github/actions/run-bazel-test | ||
| with: | ||
| target: //test/integration/extension/queue/... | ||
|
|
||
| storage-integration-test: | ||
| name: Storage Extension Test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: ./.github/actions/setup | ||
| - uses: ./.github/actions/run-bazel-test | ||
| with: | ||
| target: //test/integration/extension/storage/... | ||
|
|
||
| # --------------------------------------------------------------------------- | ||
| # REQUIRED CHECKS GATE | ||
| # --------------------------------------------------------------------------- | ||
| required-checks: | ||
| name: Required Checks | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build-and-unit-test | ||
| - e2e | ||
| - gateway-integration-test | ||
| - orchestrator-integration-test | ||
| - counter-integration-test | ||
| - queue-integration-test | ||
| - storage-integration-test | ||
| steps: | ||
| - name: All required checks passed | ||
| run: | | ||
| echo "All required checks passed!" >&2 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,7 @@ MODULE.bazel.lock | |
|
|
||
| # Built binaries | ||
| bin/ | ||
| .docker-bin/ | ||
|
|
||
| # Make completion cache | ||
| .make_targets_cache | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.