-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (116 loc) · 4.22 KB
/
e2e.yml
File metadata and controls
136 lines (116 loc) · 4.22 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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"
echo "$SUMMARY"
echo "EOF"
} >> "$GITHUB_OUTPUT"
# Add to GitHub Actions step summary
{
echo "## E2E Test Results"
echo ""
echo '```'
echo "$SUMMARY"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
else
{
echo "total=0"
echo "passed=0"
echo "failed=0"
echo "summary=No results file found"
} >> "$GITHUB_OUTPUT"
fi
- name: Upload test artifacts
if: always()
id: upload_artifacts
uses: actions/upload-artifact@v4
with:
name: e2e-test-results
path: |
e2e-tests/mcpchecker/mcpchecker-stackrox-mcp-e2e-out.json
e2e-tests/mcpchecker/*-error.txt
wiremock/wiremock.log
if-no-files-found: ignore
- 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 }})
**Artifacts:** [Download test results & logs](${{ steps.upload_artifacts.outputs.artifact-url }})
```
${{ 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 }})
**Artifacts:** [Download test results & logs](${{ steps.upload_artifacts.outputs.artifact-url }})