Add SonarCloud integration

This commit is contained in:
GeorgH93 2021-11-05 20:25:13 +01:00
parent 97917ad4b9
commit 410ce286e7
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
2 changed files with 39 additions and 0 deletions

36
.github/workflows/sonarcloud.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: SonarCloud
on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
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 -Dsonar.projectKey=GeorgH93_Minepacks

View File

@ -10,6 +10,9 @@
<revision>2.4.3-RC3</revision>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<sonar.organization>georgh93</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
</properties>
<scm>