From 0ebc06969935814a0f3da14623b9681fe16bf480 Mon Sep 17 00:00:00 2001 From: csviri Date: Fri, 7 Jan 2022 17:02:32 +0100 Subject: [PATCH 1/2] feature: sonar for builds --- .github/workflows/sonar.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/sonar.yml diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000000..d5e461e70e --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,43 @@ +name: Sonar + +env: + MAVEN_ARGS: -V -ntp -e + +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true +on: + push: + branches: [ main ] + pull_request: + types: [ opened, synchronize, reopened ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Java and Maven + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 17 + cache: 'maven' + - name: Cache SonarCloud packages + uses: actions/cache@v1 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + - name: Cache Maven packages + uses: actions/cache@v1 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Build and analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.jacoco:jacoco-maven-plugin:report org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=java-operator-sdk_java-operator-sdk + From 47a7311652d26b52bb149f41aff23485ec5c90d2 Mon Sep 17 00:00:00 2001 From: csviri Date: Fri, 7 Jan 2022 17:05:27 +0100 Subject: [PATCH 2/2] fix: sonar url --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 2d85db1136..ea9f16c92b 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,8 @@ 11 ${java.version} ${java.version} + java-operator-sdk + https://sonarcloud.io 5.8.2 5.11.2