-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (97 loc) · 3.7 KB
/
e2e.yml
File metadata and controls
116 lines (97 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 }})