Add sonarcloud to GitHub actions
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Aug 2021 11:02:09 +0000 (13:02 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 21 Aug 2021 11:02:09 +0000 (13:02 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
.github/workflows/build.yml
sonar-project.properties [new file with mode: 0644]

index 47a8f675c869b9c5524be246042749e5c84b8d48..5396c211338ce6656dd32cf6d7eaf67d7272cfe5 100644 (file)
@@ -4,6 +4,7 @@ on:
     branches:
       - master
   pull_request:
+    types: [opened, synchronize, reopened]
     branches:
       - master
 jobs:
@@ -33,4 +34,16 @@ jobs:
       run: |
         cd docker
         make SUBMODULES_INIT=false
+   sonarcloud:
+    name: SonarCloud
+    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: SonarCloud Scan
+        uses: SonarSource/sonarcloud-github-action@master
+        env:
+          GITHUB_TOKEN: ${{ secrets.USER_TOKEN }}  # Needed to get PR information, if any
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
 
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644 (file)
index 0000000..66831a5
--- /dev/null
@@ -0,0 +1,12 @@
+sonar.projectKey=jerome-benoit_ev-simulator
+sonar.organization=jerome-benoit
+
+# This is the name and version displayed in the SonarCloud UI.
+#sonar.projectName=ev-simulator
+#sonar.projectVersion=1.0
+
+# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
+#sonar.sources=.
+
+# Encoding of the source code. Default is default system encoding
+#sonar.sourceEncoding=UTF-8