2727
2828 - name : Gradle cache
2929 uses : gradle/actions/setup-gradle@v3
30-
30+
3131 - name : Configure Gradle memory settings
3232 run : |
3333 echo "org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError" >> gradle.properties
3939 run : |
4040 # Build the project
4141 ./gradlew assembleDebug --stacktrace
42-
42+
4343 # Run tests with coverage - allow test failures
4444 ./gradlew testDebugUnitTest jacocoTestReport --stacktrace
4545 TEST_RESULT=$?
@@ -48,38 +48,38 @@ jobs:
4848 # Even if tests fail, JaCoCo should generate a report with partial coverage
4949 # from the tests that did pass
5050 fi
51-
51+
5252 - name : Prepare class files for SonarQube analysis
5353 run : |
5454 echo "Searching for compiled class files..."
55-
55+
5656 # Create the target directory
5757 mkdir -p build/intermediates/runtime_library_classes_dir/debug
58-
58+
5959 # Find all directories containing class files with better patterns
6060 CLASS_DIRS=$(find build -name "*.class" -type f -exec dirname {} \; | sort -u | grep -E "(javac|kotlin-classes|runtime_library)" | head -10)
61-
61+
6262 if [ -z "$CLASS_DIRS" ]; then
6363 echo "WARNING: No class files found in the build directory!"
6464 echo "Searching in all build subdirectories..."
6565 find build -name "*.class" -type f | head -20
6666 else
6767 echo "Found class files in the following directories:"
6868 echo "$CLASS_DIRS"
69-
69+
7070 # Copy classes from all relevant directories, not just the first one
7171 for CLASS_DIR in $CLASS_DIRS; do
7272 if [ -d "$CLASS_DIR" ] && [ "$(find "$CLASS_DIR" -name "*.class" | wc -l)" -gt 0 ]; then
7373 echo "Copying classes from $CLASS_DIR"
7474 cp -r "$CLASS_DIR"/* build/intermediates/runtime_library_classes_dir/debug/ 2>/dev/null || echo "Failed to copy from $CLASS_DIR"
7575 fi
7676 done
77-
77+
7878 # Verify the target directory now has class files
7979 CLASS_COUNT=$(find build/intermediates/runtime_library_classes_dir/debug -name "*.class" | wc -l)
8080 echo "Target directory now contains $CLASS_COUNT class files"
8181 fi
82-
82+
8383 # Update sonar-project.properties with all found class directories
8484 echo "" >> sonar-project.properties
8585 echo "# Additional binary paths found during build" >> sonar-project.properties
@@ -90,14 +90,14 @@ jobs:
9090 else
9191 echo "sonar.java.binaries=build/intermediates/runtime_library_classes_dir/debug" >> sonar-project.properties
9292 fi
93-
93+
9494 echo "Checking for JaCoCo report files..."
9595 find build -name "*.xml" | grep jacoco || echo "No JaCoCo XML files found"
9696 find build -name "*.exec" | grep jacoco || echo "No JaCoCo exec files found"
97-
97+
9898 echo "Contents of JaCoCo report directory:"
9999 ls -la build/reports/jacoco/jacocoTestReport/ || echo "Directory not found"
100-
100+
101101 echo ""
102102 echo "Checking test execution results:"
103103 TEST_RESULT_FILES=$(find build -name "TEST-*.xml" 2>/dev/null)
@@ -112,7 +112,7 @@ jobs:
112112 else
113113 echo "No test result files found"
114114 fi
115-
115+
116116 echo ""
117117 echo "Checking JaCoCo report content:"
118118 if [ -f build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml ]; then
@@ -130,22 +130,22 @@ jobs:
130130 else
131131 echo "JaCoCo report file not found"
132132 fi
133-
133+
134134 echo ""
135135 echo "Checking binary directories specified in sonar-project.properties:"
136136 echo "build/intermediates/runtime_library_classes_dir/debug:"
137137 ls -la build/intermediates/runtime_library_classes_dir/debug || echo "Directory not found"
138-
138+
139139 echo ""
140140 echo "Checking all available class directories:"
141141 find build -path "*/build/*" -name "*.class" | head -n 10 || echo "No class files found"
142-
142+
143143 echo ""
144144 echo "Final sonar-project.properties content:"
145145 cat sonar-project.properties
146146
147147 - name : SonarCloud Scan
148- uses : SonarSource/sonarqube-scan-action@v5
148+ uses : SonarSource/sonarqube-scan-action@v6
149149 env :
150150 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information
151151 SONAR_TOKEN : ${{ secrets.SONARQUBE_TOKEN }}
0 commit comments