fix: Test coverage update (#11) #55
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: SonarCloud Analysis | |
on: | |
push: | |
branches: | |
- main | |
- release-* | |
pull_request: | |
types: | |
- opened | |
- edited | |
- synchronize | |
jobs: | |
sonarcloud: | |
name: SonarCloud Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4.1.7 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4.2.1 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Cache Maven packages | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build and test with Maven | |
run: mvn clean org.jacoco:jacoco-maven-plugin:0.8.8:prepare-agent verify org.jacoco:jacoco-maven-plugin:0.8.8:report org.jacoco:jacoco-maven-plugin:0.8.8:report-aggregate -B | |
- name: Generate JaCoCo XML Report | |
run: mvn org.jacoco:jacoco-maven-plugin:0.8.8:report -Djacoco.reportFormat=xml -B | |
- name: SonarCloud Scan | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
mvn sonar:sonar \ | |
-Dsonar.projectKey=${{ vars.SONARCLOUD_PROJECT_KEY }} \ | |
-Dsonar.organization=${{ vars.SONARCLOUD_ORG }} \ | |
-Dsonar.host.url=https://sonarcloud.io \ | |
-Dsonar.token=${{ secrets.SONAR_TOKEN }} \ | |
-Dsonar.java.binaries=target/classes \ | |
-Dsonar.junit.reportPaths=target/surefire-reports \ | |
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml \ | |
-Dsonar.exclusions=**/configuration/**,**/enums/**,**/model/**,**/stub/**,**/dto/**,**/*Constant*,**/*Config.java,**/*Scheduler.java,**/*Application.java,**/src/test/**,**/Dummy*.java | |
- name: Fetch all branches | |
run: git fetch --all |