diff --git a/.github/workflows/sonarscan.yaml b/.github/workflows/sonarscan.yaml new file mode 100644 index 000000000..36f33426f --- /dev/null +++ b/.github/workflows/sonarscan.yaml @@ -0,0 +1,48 @@ +name: Execute SonarCloud Scan with Test Execution +on: + push: + branches: + - main + workflow_call: + +jobs: + analyze: + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + + #Use Maven package cache + - name: Cache local Maven repository + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + + #Use Sonar cache + - name: Cache SonarCloud packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + #Verify with tests and sonar analysis + - name: Verify + run: ./mvnw -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/pom.xml b/pom.xml index cca6f75b0..048f9aee0 100644 --- a/pom.xml +++ b/pom.xml @@ -52,6 +52,12 @@ 3.1.1 3.23.1 3.0.0 + catenax + https://sonarcloud.io + bptm + ${project.groupId}:${project.artifactId} + 3.9.1.2184 + 0.8.7 @@ -211,6 +217,36 @@ automotive.tractusx + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar.version} + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + prepare-agent + + prepare-agent + + + + report + + report + + + + XML + + + + +