-
Notifications
You must be signed in to change notification settings - Fork 0
Add E2E tests to CI with PR comment reporting #49
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
be39d09
Add E2E tests to CI with PR comment reporting
janisz ab92c37
Simplify E2E workflow
janisz 2985563
Use make target instead of direct script invocation
janisz fff63df
Use mcpchecker summary command with GitHub Actions format
janisz e2ec873
Use mcpchecker human-readable summary in PR comments
janisz 6f795c2
Use OpenAI agent (gpt-5-nano) for E2E tests
janisz d78d887
fix
janisz 58d3e1e
Apply suggestions from code review
janisz 1a524dc
fix
janisz 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,116 @@ | ||
| name: E2E Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
|
|
||
| # Cancel in-progress runs for the same PR when new commits are pushed | ||
| concurrency: | ||
| group: e2e-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| e2e: | ||
| name: Run E2E Tests | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Setup proto files | ||
| run: make proto-setup | ||
|
|
||
| - name: Generate proto descriptors | ||
| run: make proto-generate | ||
|
|
||
| - name: Download WireMock | ||
| run: make mock-download | ||
|
|
||
| - name: Run E2E tests | ||
| env: | ||
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| MODEL_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| run: make e2e-test | ||
|
|
||
| - name: Parse test results | ||
| if: always() | ||
| id: parse_results | ||
| run: | | ||
| RESULTS_FILE="e2e-tests/mcpchecker/mcpchecker-stackrox-mcp-e2e-out.json" | ||
| if [ -f "$RESULTS_FILE" ]; then | ||
| cd e2e-tests/mcpchecker | ||
|
|
||
| # Get stats in GitHub Actions format | ||
| ../../e2e-tests/bin/mcpchecker summary mcpchecker-stackrox-mcp-e2e-out.json --github-output >> $GITHUB_OUTPUT | ||
|
|
||
| # Get human-readable summary for PR comment | ||
| SUMMARY=$(../../e2e-tests/bin/mcpchecker summary mcpchecker-stackrox-mcp-e2e-out.json) | ||
| echo "summary<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$SUMMARY" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| # Add to GitHub Actions step summary | ||
| echo "## E2E Test Results" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY | ||
| echo '```' >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "total=0" >> $GITHUB_OUTPUT | ||
| echo "passed=0" >> $GITHUB_OUTPUT | ||
| echo "failed=0" >> $GITHUB_OUTPUT | ||
| echo "summary=No results file found" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Find existing comment | ||
| if: always() | ||
| uses: peter-evans/find-comment@v3 | ||
| id: find_comment | ||
| with: | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| comment-author: 'github-actions[bot]' | ||
| body-includes: '<!-- e2e-test-results -->' | ||
|
|
||
| - name: Create or update comment - Success | ||
| if: success() | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| comment-id: ${{ steps.find_comment.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| edit-mode: replace | ||
| body: | | ||
| <!-- e2e-test-results --> | ||
| ## E2E Test Results | ||
|
|
||
| **Commit:** ${{ github.event.pull_request.head.sha }} | ||
| **Workflow Run:** [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
|
|
||
| ``` | ||
| ${{ steps.parse_results.outputs.summary }} | ||
| ``` | ||
|
|
||
| - name: Create or update comment - Failure | ||
| if: failure() | ||
| uses: peter-evans/create-or-update-comment@v4 | ||
| with: | ||
| comment-id: ${{ steps.find_comment.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| edit-mode: replace | ||
| body: | | ||
| <!-- e2e-test-results --> | ||
| ## E2E Test Results - ❌ Job Failed | ||
|
|
||
| **Commit:** ${{ github.event.pull_request.head.sha }} | ||
| **Workflow Run:** [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | ||
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.