Skip to content

Commit 1ca4965

Browse files
authored
Release 5.5.0 (#860)
2 parents 164fe5d + 7262106 commit 1ca4965

File tree

1,293 files changed

+14502
-1939
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,293 files changed

+14502
-1939
lines changed

.github/workflows/sonarqube.yml

Lines changed: 82 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: SonarCloud Analysis
22

33
on:
4+
push:
5+
branches:
6+
- master
7+
- development
8+
- '*_baseline'
49
pull_request:
510
branches:
611
- '*'
@@ -41,111 +46,98 @@ jobs:
4146
- name: Build project and run tests with coverage
4247
run: |
4348
# Build the project
44-
./gradlew assembleDebug --stacktrace
45-
46-
# Run tests with coverage - allow test failures
47-
./gradlew testDebugUnitTest jacocoTestReport --stacktrace
48-
TEST_RESULT=$?
49-
if [ $TEST_RESULT -ne 0 ]; then
50-
echo "Some tests failed, but continuing to check for coverage data..."
51-
# Even if tests fail, JaCoCo should generate a report with partial coverage
52-
# from the tests that did pass
53-
fi
54-
55-
- name: Prepare class files for SonarQube analysis
56-
run: |
57-
echo "Searching for compiled class files..."
58-
59-
# Create the target directory
60-
mkdir -p build/intermediates/runtime_library_classes_dir/debug
61-
62-
# Find all directories containing class files with better patterns
63-
CLASS_DIRS=$(find build -name "*.class" -type f -exec dirname {} \; | sort -u | grep -E "(javac|kotlin-classes|runtime_library)" | head -10)
64-
65-
if [ -z "$CLASS_DIRS" ]; then
66-
echo "WARNING: No class files found in the build directory!"
67-
echo "Searching in all build subdirectories..."
68-
find build -name "*.class" -type f | head -20
49+
./gradlew assembleDebug
50+
51+
# Run tests - continue even if some tests fail
52+
./gradlew testDebugUnitTest || echo "Some tests failed, but continuing to generate coverage report..."
53+
54+
# Generate JaCoCo aggregate report separately (ensures it runs even if tests failed)
55+
./gradlew jacocoRootReport
56+
57+
# Log report location for debugging
58+
REPORT_PATH="build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
59+
if [ -f "$REPORT_PATH" ]; then
60+
echo "✓ JaCoCo report generated at: $REPORT_PATH ($(wc -c < "$REPORT_PATH") bytes)"
6961
else
70-
echo "Found class files in the following directories:"
71-
echo "$CLASS_DIRS"
72-
73-
# Copy classes from all relevant directories, not just the first one
74-
for CLASS_DIR in $CLASS_DIRS; do
75-
if [ -d "$CLASS_DIR" ] && [ "$(find "$CLASS_DIR" -name "*.class" | wc -l)" -gt 0 ]; then
76-
echo "Copying classes from $CLASS_DIR"
77-
cp -r "$CLASS_DIR"/* build/intermediates/runtime_library_classes_dir/debug/ 2>/dev/null || echo "Failed to copy from $CLASS_DIR"
78-
fi
79-
done
80-
81-
# Verify the target directory now has class files
82-
CLASS_COUNT=$(find build/intermediates/runtime_library_classes_dir/debug -name "*.class" | wc -l)
83-
echo "Target directory now contains $CLASS_COUNT class files"
62+
echo "✗ JaCoCo report was NOT generated at: $REPORT_PATH"
8463
fi
8564
86-
# Update sonar-project.properties with all found class directories
87-
echo "" >> sonar-project.properties
88-
echo "# Additional binary paths found during build" >> sonar-project.properties
89-
if [ -n "$CLASS_DIRS" ]; then
90-
# Convert newlines to commas for sonar.java.binaries
91-
BINARY_PATHS=$(echo "$CLASS_DIRS" | tr '\n' ',' | sed 's/,$//')
92-
echo "sonar.java.binaries=build/intermediates/runtime_library_classes_dir/debug,$BINARY_PATHS" >> sonar-project.properties
65+
- name: Verify class files and coverage data for SonarQube analysis
66+
run: |
67+
echo "=== Verifying Build Artifacts for SonarQube ==="
68+
echo ""
69+
70+
# Dynamically get modules from settings.gradle (extract module names from "include ':modulename'" lines)
71+
MODULES=$(grep "^include" settings.gradle | cut -d"'" -f2 | cut -d":" -f2 | tr '\n' ' ')
72+
echo "Detected modules: $MODULES"
73+
echo ""
74+
75+
echo "Checking compiled class files for each module:"
76+
for module in $MODULES; do
77+
MODULE_CLASSES_DIR="${module}/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
78+
if [ -d "$MODULE_CLASSES_DIR" ]; then
79+
CLASS_COUNT=$(find "$MODULE_CLASSES_DIR" -name "*.class" | wc -l)
80+
echo " ✓ ${module}: Found $CLASS_COUNT class files in $MODULE_CLASSES_DIR"
81+
else
82+
echo " ✗ ${module}: Class directory not found: $MODULE_CLASSES_DIR"
83+
fi
84+
done
85+
86+
echo ""
87+
echo "Checking JaCoCo coverage report:"
88+
if [ -f build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml ]; then
89+
REPORT_SIZE=$(wc -c < build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml)
90+
PACKAGE_COUNT=$(grep -c "<package" build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml || echo "0")
91+
CLASS_COUNT=$(grep -c "<class" build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml || echo "0")
92+
LINE_COUNT=$(grep -c "<line" build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml || echo "0")
93+
COVERED_LINES=$(grep -c 'ci="1"' build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml || echo "0")
94+
95+
echo " ✓ JaCoCo report found: build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
96+
echo " - Size: $REPORT_SIZE bytes"
97+
echo " - Packages: $PACKAGE_COUNT"
98+
echo " - Classes: $CLASS_COUNT"
99+
echo " - Lines: $LINE_COUNT"
100+
echo " - Covered lines: $COVERED_LINES"
101+
102+
# Check if events module coverage is present
103+
if grep -q 'package name="io/harness/events"' build/reports/jacoco/jacocoRootReport/jacocoRootReport.xml; then
104+
echo " ✓ Events module (io/harness/events) coverage found in report"
105+
else
106+
echo " ✗ WARNING: Events module coverage NOT found in report"
107+
fi
93108
else
94-
echo "sonar.java.binaries=build/intermediates/runtime_library_classes_dir/debug" >> sonar-project.properties
109+
echo " ✗ JaCoCo report file not found"
95110
fi
96-
97-
echo "Checking for JaCoCo report files..."
98-
find build -name "*.xml" | grep jacoco || echo "No JaCoCo XML files found"
99-
find build -name "*.exec" | grep jacoco || echo "No JaCoCo exec files found"
100-
101-
echo "Contents of JaCoCo report directory:"
102-
ls -la build/reports/jacoco/jacocoTestReport/ || echo "Directory not found"
103-
111+
104112
echo ""
105-
echo "Checking test execution results:"
113+
echo "Checking JaCoCo execution data for each module:"
114+
for module in $MODULES; do
115+
EXEC_FILE="${module}/build/jacoco/testDebugUnitTest.exec"
116+
if [ -f "$EXEC_FILE" ]; then
117+
EXEC_SIZE=$(wc -c < "$EXEC_FILE")
118+
echo " ✓ ${module}: Found execution data ($EXEC_SIZE bytes) in $EXEC_FILE"
119+
else
120+
echo " ✗ ${module}: Execution data not found: $EXEC_FILE"
121+
fi
122+
done
123+
124+
echo ""
125+
echo "Test execution summary:"
106126
TEST_RESULT_FILES=$(find build -name "TEST-*.xml" 2>/dev/null)
107127
if [ -n "$TEST_RESULT_FILES" ]; then
108-
echo "Found test result files:"
109-
echo "$TEST_RESULT_FILES"
110-
# Count total tests, failures, errors
111128
TOTAL_TESTS=$(cat $TEST_RESULT_FILES | grep -o 'tests="[0-9]*"' | cut -d'"' -f2 | awk '{sum+=$1} END {print sum}')
112129
TOTAL_FAILURES=$(cat $TEST_RESULT_FILES | grep -o 'failures="[0-9]*"' | cut -d'"' -f2 | awk '{sum+=$1} END {print sum}')
113130
TOTAL_ERRORS=$(cat $TEST_RESULT_FILES | grep -o 'errors="[0-9]*"' | cut -d'"' -f2 | awk '{sum+=$1} END {print sum}')
114-
echo "Test summary: $TOTAL_TESTS tests, $TOTAL_FAILURES failures, $TOTAL_ERRORS errors"
131+
echo " Tests: $TOTAL_TESTS | Failures: $TOTAL_FAILURES | Errors: $TOTAL_ERRORS"
115132
else
116-
echo "No test result files found"
133+
echo " No test result files found"
117134
fi
118-
135+
119136
echo ""
120-
echo "Checking JaCoCo report content:"
121-
if [ -f build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml ]; then
122-
echo "Report file size: $(wc -c < build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml) bytes"
123-
echo "First 500 chars of report:"
124-
head -c 500 build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
125-
echo ""
126-
echo ""
127-
echo "Counting coverage elements:"
128-
grep -c "<package" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No packages found"
129-
grep -c "<class" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No classes found"
130-
grep -c "<method" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No methods found"
131-
grep -c "<line" build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No lines found"
132-
grep -c 'ci="1"' build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml || echo "No covered lines found"
133-
else
134-
echo "JaCoCo report file not found"
135-
fi
136-
137-
echo ""
138-
echo "Checking binary directories specified in sonar-project.properties:"
139-
echo "build/intermediates/runtime_library_classes_dir/debug:"
140-
ls -la build/intermediates/runtime_library_classes_dir/debug || echo "Directory not found"
141-
142-
echo ""
143-
echo "Checking all available class directories:"
144-
find build -path "*/build/*" -name "*.class" | head -n 10 || echo "No class files found"
145-
146-
echo ""
147-
echo "Final sonar-project.properties content:"
137+
echo "SonarQube configuration (sonar-project.properties):"
148138
cat sonar-project.properties
139+
echo ""
140+
echo "=== Verification Complete ==="
149141
150142
- name: SonarCloud Scan
151143
uses: SonarSource/sonarqube-scan-action@v7

0 commit comments

Comments
 (0)