1+ ---
12name : Running hyperconverged smoke tests
23
3- on :
4+ " on " :
45 workflow_dispatch :
56 inputs :
67 acmeEmail :
3940 - " test"
4041 - " deploy"
4142 - " cleanup"
43+ run_tests :
44+ description : Run post-deployment tests
45+ required : false
46+ default : true
47+ type : boolean
48+ test_level :
49+ description : Test level to run
50+ required : false
51+ default : " quick"
52+ type : choice
53+ options :
54+ - " quick"
55+ - " standard"
56+ - " full"
4257 pull_request :
4358 paths :
4459 - ansible/**
5469 ACME_EMAIL : cloud@example.local
5570 OS_IMAGE : " Ubuntu 24.04"
5671 SSH_USERNAME : " ubuntu"
72+ TEST_LEVEL : " quick"
5773
5874jobs :
5975 smoke-deploy :
8197 if : ${{ github.event_name == 'pull_request' || contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode) }}
8298 run : |
8399 eval "$(ssh-agent -s)"
100+ export TEST_LEVEL="${{ github.event.inputs.test_level }}"
84101 scripts/hyperconverged-lab.sh
85102
86103 - name : Retrieve Keys
@@ -106,6 +123,71 @@ jobs:
106123 } >> $GITHUB_STEP_SUMMARY
107124 fi
108125
126+ - name : Upload Test Results
127+ if : ${{ always() && (github.event_name == 'pull_request' || (github.event.inputs.run_tests == 'true' && contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode))) }}
128+ uses : actions/upload-artifact@v4
129+ with :
130+ name : test-results-${{ github.run_number }}
131+ path : test-results/
132+ if-no-files-found : ignore
133+ retention-days : 30
134+
135+ - name : Publish Test Summary
136+ if : ${{ always() && (github.event_name == 'pull_request' || (github.event.inputs.run_tests == 'true' && contains(fromJSON('["deploy", "test"]'), github.event.inputs.mode))) }}
137+ run : |
138+ echo "## Test Results" >> $GITHUB_STEP_SUMMARY
139+ echo "" >> $GITHUB_STEP_SUMMARY
140+
141+ if [ -f test-results/aggregate-results.txt ]; then
142+ echo "### Test Suite Summary" >> $GITHUB_STEP_SUMMARY
143+ echo "" >> $GITHUB_STEP_SUMMARY
144+ echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY
145+ echo "|------------|--------|" >> $GITHUB_STEP_SUMMARY
146+
147+ while IFS=: read -r suite status; do
148+ status=$(echo "$status" | xargs)
149+ if [ "$status" = "PASSED" ]; then
150+ echo "| $suite | :white_check_mark: PASSED |" >> $GITHUB_STEP_SUMMARY
151+ else
152+ echo "| $suite | :x: FAILED |" >> $GITHUB_STEP_SUMMARY
153+ fi
154+ done < test-results/aggregate-results.txt
155+
156+ echo "" >> $GITHUB_STEP_SUMMARY
157+ fi
158+
159+ # Parse XML results if available
160+ if ls test-results/*.xml >/dev/null 2>&1; then
161+ echo "### Detailed Test Results" >> $GITHUB_STEP_SUMMARY
162+ echo "" >> $GITHUB_STEP_SUMMARY
163+
164+ for xml_file in test-results/*.xml; do
165+ if [ -f "$xml_file" ]; then
166+ suite_name=$(grep -o 'name="[^"]*"' "$xml_file" | head -1 | sed 's/name="//;s/"//')
167+ echo "#### $suite_name" >> $GITHUB_STEP_SUMMARY
168+ echo "" >> $GITHUB_STEP_SUMMARY
169+ echo "| Test | Status |" >> $GITHUB_STEP_SUMMARY
170+ echo "|------|--------|" >> $GITHUB_STEP_SUMMARY
171+
172+ grep -o '<testcase name="[^"]*"' "$xml_file" | sed 's/<testcase name="//;s/"$//' | while read test; do
173+ if grep -q "name=\"${test}\".*<failure" "$xml_file"; then
174+ echo "| $test | :x: Failed |" >> $GITHUB_STEP_SUMMARY
175+ elif grep -q "name=\"${test}\".*<skipped" "$xml_file"; then
176+ echo "| $test | :warning: Skipped |" >> $GITHUB_STEP_SUMMARY
177+ else
178+ echo "| $test | :white_check_mark: Passed |" >> $GITHUB_STEP_SUMMARY
179+ fi
180+ done
181+
182+ echo "" >> $GITHUB_STEP_SUMMARY
183+ fi
184+ done
185+ fi
186+
187+ if [ ! -f test-results/aggregate-results.txt ] && ! ls test-results/*.xml >/dev/null 2>&1; then
188+ echo "_No test results available_" >> $GITHUB_STEP_SUMMARY
189+ fi
190+
109191 - name : Cleanup the lab
110192 if : ${{ always() && (github.event_name == 'pull_request' || contains(fromJSON('["cleanup", "test"]'), github.event.inputs.mode)) }}
111193 run : scripts/hyperconverged-lab-uninstall.sh
0 commit comments