Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,32 @@ jobs:
./internal/commands/.scripts/integration_up.sh
./internal/commands/.scripts/integration_down.sh

- name: Display Test Summary
if: always()
shell: bash
run: |
if [ -f test_summary.txt ]; then
source test_summary.txt

echo "## 📊 Integration Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| ✅ **Passed** | $PASSED_TESTS |" >> $GITHUB_STEP_SUMMARY
echo "| ❌ **Failed** | $FAILED_TESTS |" >> $GITHUB_STEP_SUMMARY
echo "| ⏭️ **Skipped** | $SKIPPED_TESTS |" >> $GITHUB_STEP_SUMMARY
echo "| 📝 **Total** | $TOTAL_TESTS |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY

if [ "$FAILED_TESTS" -eq 0 ]; then
echo "### ✅ All tests passed!" >> $GITHUB_STEP_SUMMARY
else
echo "### ⚠️ Some tests failed" >> $GITHUB_STEP_SUMMARY
fi
else
echo "⚠️ Test summary file not found" >> $GITHUB_STEP_SUMMARY
fi

- name: Coverage report
uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 #v4
with:
Expand Down
13 changes: 13 additions & 0 deletions internal/commands/.scripts/integration_up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ if [ $status -ne 0 ]; then
echo "Integration tests failed"
fi

# Generate test summary statistics
TOTAL_TESTS=$(grep -E "^(--- PASS:|--- FAIL:)" test_output.log | wc -l)
PASSED_TESTS=$(grep -E "^--- PASS:" test_output.log | wc -l)
FAILED_TESTS=$(grep -E "^--- FAIL:" test_output.log | wc -l)
SKIPPED_TESTS=$(grep -E "^--- SKIP:" test_output.log | wc -l)

# Save summary to file for GitHub Actions
echo "TOTAL_TESTS=$TOTAL_TESTS" > test_summary.txt
echo "PASSED_TESTS=$PASSED_TESTS" >> test_summary.txt
echo "FAILED_TESTS=$FAILED_TESTS" >> test_summary.txt
echo "SKIPPED_TESTS=$SKIPPED_TESTS" >> test_summary.txt

# Step 4: Check if failedTests file is empty
if [ ! -s "$FAILED_TESTS_FILE" ]; then
# If the file is empty, all tests passed
Expand Down Expand Up @@ -86,6 +98,7 @@ go test -v github.com/checkmarx/ast-cli/test/cleandata
# Step 8: Final cleanup and exit
rm -f "$FAILED_TESTS_FILE" test_output.log

# Keep test_summary.txt for GitHub Actions to read
if [ $status -ne 0 ] || [ $rerun_status -eq 1 ]; then
exit 1
else
Expand Down
Loading