From 1698fcb3abd09334dd300207dfb51d7328b420c1 Mon Sep 17 00:00:00 2001 From: Amol Mane <22643905+cx-amol-mane@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:40:42 +0530 Subject: [PATCH 1/2] Add integration test summary reporting to CI workflow --- .github/workflows/ci-tests.yml | 26 ++++++++++++++++++++ internal/commands/.scripts/integration_up.sh | 15 ++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 217b51eb4..83ce82a5a 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -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: diff --git a/internal/commands/.scripts/integration_up.sh b/internal/commands/.scripts/integration_up.sh index 62708467b..bd54af0c2 100755 --- a/internal/commands/.scripts/integration_up.sh +++ b/internal/commands/.scripts/integration_up.sh @@ -27,7 +27,7 @@ go test \ -timeout 210m \ -coverpkg github.com/checkmarx/ast-cli/internal/commands,github.com/checkmarx/ast-cli/internal/services,github.com/checkmarx/ast-cli/internal/wrappers \ -coverprofile cover.out \ - github.com/checkmarx/ast-cli/test/integration 2>&1 | tee test_output.log + github.com/checkmarx/ast-cli/test/integration/auth_test.go 2>&1 | tee test_output.log # Generate the initial HTML coverage report go tool cover -html=cover.out -o coverage.html @@ -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 @@ -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 From 95f44a6908dd14be3c6e62fae5051514c57d6d61 Mon Sep 17 00:00:00 2001 From: Amol Mane <22643905+cx-amol-mane@users.noreply.github.com> Date: Tue, 6 Jan 2026 12:46:13 +0530 Subject: [PATCH 2/2] Update integration test command to run all tests in the integration directory --- internal/commands/.scripts/integration_up.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/commands/.scripts/integration_up.sh b/internal/commands/.scripts/integration_up.sh index bd54af0c2..eb1dc6472 100755 --- a/internal/commands/.scripts/integration_up.sh +++ b/internal/commands/.scripts/integration_up.sh @@ -27,7 +27,7 @@ go test \ -timeout 210m \ -coverpkg github.com/checkmarx/ast-cli/internal/commands,github.com/checkmarx/ast-cli/internal/services,github.com/checkmarx/ast-cli/internal/wrappers \ -coverprofile cover.out \ - github.com/checkmarx/ast-cli/test/integration/auth_test.go 2>&1 | tee test_output.log + github.com/checkmarx/ast-cli/test/integration 2>&1 | tee test_output.log # Generate the initial HTML coverage report go tool cover -html=cover.out -o coverage.html