-
Notifications
You must be signed in to change notification settings - Fork 2
353 lines (309 loc) · 13.8 KB
/
integration.yml
File metadata and controls
353 lines (309 loc) · 13.8 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
---
name: Integration Tests
on:
push:
branches:
- 'feature/**'
- 'hotfix/**'
- 'bugfix/**'
- 'release/**'
- 'major/**'
- master
pull_request:
branches:
- master
types:
- opened
- synchronize
- reopened
workflow_dispatch:
inputs:
interx_url:
description: 'Interx server URL to test against'
required: false
default: 'http://3.123.154.245:11000'
test_address:
description: 'Test account address'
required: false
default: 'kira143q8vxpvuykt9pq50e6hng9s38vmy844n8k9wx'
env:
INTERX_URL: ${{ github.event.inputs.interx_url || 'http://3.123.154.245:11000' }}
TEST_ADDRESS: ${{ github.event.inputs.test_address || 'kira143q8vxpvuykt9pq50e6hng9s38vmy844n8k9wx' }}
jobs:
smoke-tests:
name: Smoke Tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check server availability
id: server-check
run: |
echo "Testing connection to $INTERX_URL"
if curl -sf "$INTERX_URL/api/status" > /dev/null; then
echo "server_available=true" >> $GITHUB_OUTPUT
echo "Server is available"
else
echo "server_available=false" >> $GITHUB_OUTPUT
echo "Warning: Server at $INTERX_URL is not available"
fi
- name: Build test container
if: steps.server-check.outputs.server_available == 'true'
working-directory: tests/integration
run: docker build -t interx-integration-tests .
- name: Run smoke tests
if: steps.server-check.outputs.server_available == 'true'
working-directory: tests/integration
run: |
docker run --rm --network host \
-e INTERX_URL=${{ env.INTERX_URL }} \
-e TEST_ADDRESS=${{ env.TEST_ADDRESS }} \
interx-integration-tests \
go test -v -count=1 -run "TestInterxStatus|TestKiraStatus" ./...
outputs:
server_available: ${{ steps.server-check.outputs.server_available }}
format-validation:
name: Miro Format Validation
runs-on: ubuntu-latest
timeout-minutes: 10
needs: smoke-tests
if: needs.smoke-tests.outputs.server_available == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build test container
working-directory: tests/integration
run: docker build -t interx-integration-tests .
- name: Run format validation tests
id: format-tests
working-directory: tests/integration
run: |
docker run --rm --network host \
-e INTERX_URL=${{ env.INTERX_URL }} \
-e TEST_ADDRESS=${{ env.TEST_ADDRESS }} \
interx-integration-tests \
go test -v -count=1 -run "ResponseFormat" ./... 2>&1 | tee format-test-output.log
# Count failures
FAILURES=$(grep -c "^--- FAIL" format-test-output.log || echo "0")
PASSES=$(grep -c "^--- PASS" format-test-output.log || echo "0")
echo "failures=$FAILURES" >> $GITHUB_OUTPUT
echo "passes=$PASSES" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Format test summary
run: |
echo "## Miro Format Validation Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Passed | ${{ steps.format-tests.outputs.passes }} |" >> $GITHUB_STEP_SUMMARY
echo "| Failed | ${{ steps.format-tests.outputs.failures }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.format-tests.outputs.failures }}" != "0" ]; then
echo "### Failed Tests (Known Issues)" >> $GITHUB_STEP_SUMMARY
echo "These failures track known incompatibilities with miro frontend:" >> $GITHUB_STEP_SUMMARY
echo "- Issue #13: snake_case vs camelCase" >> $GITHUB_STEP_SUMMARY
echo "- Issue #16: String vs number types" >> $GITHUB_STEP_SUMMARY
echo "- Issue #19: Missing expected fields" >> $GITHUB_STEP_SUMMARY
fi
- name: Upload format test results
uses: actions/upload-artifact@v4
if: always()
with:
name: format-validation-results
path: tests/integration/format-test-output.log
retention-days: 7
integration-tests:
name: Full Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 15
needs: smoke-tests
if: needs.smoke-tests.outputs.server_available == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build test container
working-directory: tests/integration
run: docker build -t interx-integration-tests .
- name: Run integration tests
id: integration-tests
working-directory: tests/integration
run: |
docker run --rm --network host \
-e INTERX_URL=${{ env.INTERX_URL }} \
-e TEST_ADDRESS=${{ env.TEST_ADDRESS }} \
interx-integration-tests \
go test -v -count=1 -timeout=10m ./... 2>&1 | tee test-output.log
# Parse results
FAILURES=$(grep -c "^--- FAIL" test-output.log || echo "0")
PASSES=$(grep -c "^--- PASS" test-output.log || echo "0")
TOTAL=$((FAILURES + PASSES))
echo "failures=$FAILURES" >> $GITHUB_OUTPUT
echo "passes=$PASSES" >> $GITHUB_OUTPUT
echo "total=$TOTAL" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Test summary
run: |
echo "## Integration Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| Total | ${{ steps.integration-tests.outputs.total }} |" >> $GITHUB_STEP_SUMMARY
echo "| Passed | ${{ steps.integration-tests.outputs.passes }} |" >> $GITHUB_STEP_SUMMARY
echo "| Failed | ${{ steps.integration-tests.outputs.failures }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# List failed tests
if [ "${{ steps.integration-tests.outputs.failures }}" != "0" ]; then
echo "### Failed Tests" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep "^--- FAIL" tests/integration/test-output.log >> $GITHUB_STEP_SUMMARY || true
echo '```' >> $GITHUB_STEP_SUMMARY
fi
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-test-results
path: tests/integration/test-output.log
retention-days: 7
category-tests:
name: ${{ matrix.category.name }} Tests
runs-on: ubuntu-latest
timeout-minutes: 10
needs: smoke-tests
if: needs.smoke-tests.outputs.server_available == 'true'
strategy:
fail-fast: false
matrix:
category:
- name: Account
pattern: "Test(Account|Balances|QueryAccounts)"
- name: Transactions
pattern: "Test(Transaction|Blocks)"
- name: Validators
pattern: "Test(Validator|Consensus)"
- name: Status
pattern: "Test(Status|Dashboard|Metadata|RPC|TotalSupply)"
- name: Governance
pattern: "Test(Proposal|Voters|Votes|NetworkProperties|ExecutionFee|DataKeys|Permissions|Roles)"
- name: Staking
pattern: "Test(StakingPool|Delegations|Undelegations)"
- name: Tokens
pattern: "Test(TokenAliases|TokenRates)"
- name: Identity
pattern: "Test(Identity)"
- name: NodeDiscovery
pattern: "Test(P2P|Interx|Snap)List"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build test container
working-directory: tests/integration
run: docker build -t interx-integration-tests .
- name: Run ${{ matrix.category.name }} tests
working-directory: tests/integration
run: |
docker run --rm --network host \
-e INTERX_URL=${{ env.INTERX_URL }} \
-e TEST_ADDRESS=${{ env.TEST_ADDRESS }} \
interx-integration-tests \
go test -v -count=1 -run "${{ matrix.category.pattern }}" ./...
continue-on-error: true
test-report:
name: Test Report
runs-on: ubuntu-latest
needs: [smoke-tests, format-validation, integration-tests, category-tests]
if: always()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: test-results
continue-on-error: true
- name: Generate report
run: |
echo "## Integration Test Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Test Server:** \`${{ env.INTERX_URL }}\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Job status table
echo "### Job Status" >> $GITHUB_STEP_SUMMARY
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY
# Helper function for status emoji
status_icon() {
case "$1" in
success) echo ":white_check_mark:" ;;
failure) echo ":x:" ;;
skipped) echo ":fast_forward:" ;;
cancelled) echo ":stop_sign:" ;;
*) echo ":grey_question:" ;;
esac
}
echo "| Smoke Tests | $(status_icon "${{ needs.smoke-tests.result }}") ${{ needs.smoke-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Format Validation | $(status_icon "${{ needs.format-validation.result }}") ${{ needs.format-validation.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Integration Tests | $(status_icon "${{ needs.integration-tests.result }}") ${{ needs.integration-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "| Category Tests | $(status_icon "${{ needs.category-tests.result }}") ${{ needs.category-tests.result }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Parse integration test results if available
if [ -f "test-results/integration-test-results/test-output.log" ]; then
LOG_FILE="test-results/integration-test-results/test-output.log"
TOTAL_PASS=$(grep -c "^--- PASS" "$LOG_FILE" 2>/dev/null || echo "0")
TOTAL_FAIL=$(grep -c "^--- FAIL" "$LOG_FILE" 2>/dev/null || echo "0")
TOTAL=$((TOTAL_PASS + TOTAL_FAIL))
echo "### Integration Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| :white_check_mark: Passed | $TOTAL_PASS |" >> $GITHUB_STEP_SUMMARY
echo "| :x: Failed | $TOTAL_FAIL |" >> $GITHUB_STEP_SUMMARY
echo "| **Total** | $TOTAL |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# List failed tests if any
if [ "$TOTAL_FAIL" != "0" ]; then
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>:x: Failed Tests ($TOTAL_FAIL)</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep "^--- FAIL" "$LOG_FILE" | head -50 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
# List passed tests in collapsible section
if [ "$TOTAL_PASS" != "0" ]; then
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>:white_check_mark: Passed Tests ($TOTAL_PASS)</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep "^--- PASS" "$LOG_FILE" | head -100 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
fi
# Parse format validation results if available
if [ -f "test-results/format-validation-results/format-test-output.log" ]; then
LOG_FILE="test-results/format-validation-results/format-test-output.log"
FORMAT_PASS=$(grep -c "^--- PASS" "$LOG_FILE" 2>/dev/null || echo "0")
FORMAT_FAIL=$(grep -c "^--- FAIL" "$LOG_FILE" 2>/dev/null || echo "0")
echo "### Format Validation Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| :white_check_mark: Passed | $FORMAT_PASS |" >> $GITHUB_STEP_SUMMARY
echo "| :x: Failed | $FORMAT_FAIL |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "$FORMAT_FAIL" != "0" ]; then
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>:x: Format Validation Failures ($FORMAT_FAIL)</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
grep "^--- FAIL" "$LOG_FILE" | head -50 >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
fi
fi
echo "---" >> $GITHUB_STEP_SUMMARY
echo "*Full test logs available in workflow artifacts.*" >> $GITHUB_STEP_SUMMARY