From 06f2ba09c7d6c12340b181ac31a5b21314f70cf8 Mon Sep 17 00:00:00 2001 From: Oliver Warz Date: Fri, 9 Sep 2022 22:29:52 +0200 Subject: [PATCH] Automatic codecheck with sonarcloud --- .github/workflows/sonarcloud.yaml | 36 +++++++++++++++++++++++++++++++ pom.xml | 36 ++++++++++++++++++++++++++++++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sonarcloud.yaml diff --git a/.github/workflows/sonarcloud.yaml b/.github/workflows/sonarcloud.yaml new file mode 100644 index 0000000..6e41f9f --- /dev/null +++ b/.github/workflows/sonarcloud.yaml @@ -0,0 +1,36 @@ +name: Build +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + - 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 verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Pcoverage -Dsonar.projectKey=omaster395464gh_fop4apex \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5933e57..800e283 100644 --- a/pom.xml +++ b/pom.xml @@ -16,6 +16,8 @@ 1.8 1.8 5.9.0 + omaster395464gh + https://sonarcloud.io @@ -52,7 +54,6 @@ test - org.apache.xmlgraphics @@ -174,6 +175,39 @@ + + + coverage + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + + prepare-agent + + prepare-agent + + + + report + + report + + + + XML + + + + + + + + + github