Skip to content

Pin dependencies

Pin dependencies #235

Workflow file for this run

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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Set up JDK 21
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: 'adopt'
java-version: '21'
- name: Cache Maven packages
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Setup Maven Settings
run: |
mkdir -p ~/.m2
echo '<settings><servers><server><id>github</id><username></username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>' > ~/.m2/settings.xml
- name: Build and test with Maven
run: mvn clean org.jacoco:jacoco-maven-plugin:0.8.11:prepare-agent verify org.jacoco:jacoco-maven-plugin:0.8.11:report org.jacoco:jacoco-maven-plugin:0.8.11:report-aggregate -B
- name: Generate JaCoCo XML Report
run: mvn org.jacoco:jacoco-maven-plugin:0.8.11: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