From 6527a2fbecac8c8c04044b10d51ee4c2aec43464 Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Mon, 16 Jan 2023 16:30:11 +0100 Subject: [PATCH 1/3] cicd(Workflows): reintroduce sonarscan for pushes to main branch --- .github/workflows/sonarscan.yaml | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/sonarscan.yaml diff --git a/.github/workflows/sonarscan.yaml b/.github/workflows/sonarscan.yaml new file mode 100644 index 000000000..aadc5338c --- /dev/null +++ b/.github/workflows/sonarscan.yaml @@ -0,0 +1,46 @@ +name: Execute SonarCloud Scan with Test Execution +on: + push: + 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 }} From d05d6ed3d3468ce7b7891f9202a7fa72448c7a00 Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Tue, 17 Jan 2023 14:45:09 +0100 Subject: [PATCH 2/3] cicd(Pom): add sonarscan and test coverage configuration --- pom.xml | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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 + + + + + From 523cfe67e60e5a239fd134819629babb746cacc8 Mon Sep 17 00:00:00 2001 From: Nico Koprowski Date: Mon, 23 Jan 2023 15:13:19 +0100 Subject: [PATCH 3/3] cicd(Workflows): execute sonarscan workflow only on push to main --- .github/workflows/sonarscan.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sonarscan.yaml b/.github/workflows/sonarscan.yaml index aadc5338c..36f33426f 100644 --- a/.github/workflows/sonarscan.yaml +++ b/.github/workflows/sonarscan.yaml @@ -1,6 +1,8 @@ name: Execute SonarCloud Scan with Test Execution on: push: + branches: + - main workflow_call: jobs: