Hi,
I need help about how to upload test coverage. Currently my configuration:
// build.gradle.kts (project root)
plugins {
...
id("org.sonarqube") version "6.0.1.5171"
}
sonar {
properties {
property("sonar.projectKey", "waffiqaziz_BAZZ-Movies")
property("sonar.organization", "waffiqaziz")
property("sonar.host.url", "https://sonarcloud.io")
}
}
buildscript {
dependencies {
classpath("org.bouncycastle:bcutil-jdk18on:1.79")
}
}
# github workflow
unit_test:
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Grant execute permission for Gradle wrapper
run: chmod +x ./gradlew
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Run debug unit tests
run: ./gradlew testDebugUnitTest
- name: Generate JaCoCo
run: ./gradlew createDebugCombinedCoverageReport
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574
with:
files: ${{ github.workspace }}/**/build/reports/jacoco/createDebugCombinedCoverageReport/createDebugCombinedCoverageReport.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to Codacy
uses: codacy/codacy-coverage-reporter-action@55c3b57cb3bb6833c8c1a6614fee4cebb140de2d
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: ${{ github.workspace }}/**/build/reports/jacoco/createDebugCombinedCoverageReport/createDebugCombinedCoverageReport.xml
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@f2dba722c67b86c6caa034178c6e4d35335f6706
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: SonarCloud Scan
uses: sonarsource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=waffiqaziz_BAZZ-Movies
-Dsonar.organization=waffiqaziz
-Dsonar.coverage.jacoco.xmlReportPaths=${{ github.workspace }}/**/build/reports/jacoco/createDebugCombinedCoverageReport/createDebugCombinedCoverageReport.xml
-Dsonar.java.binaries=${{ github.workspace }}/**/build/intermediates/javac/debug/classes
-Dsonar.kotlin.binaries=${{ github.workspace }}/**/build/tmp/kotlin-classes/debug
But it doesn work, my coverage still show 0%. Here my PR
Thank you!