Enable Sonarcloud
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Fri, 1 Oct 2021 15:41:49 +0000 (17:41 +0200)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Thu, 14 Oct 2021 09:23:44 +0000 (09:23 +0000)
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
.github/workflows/sonarcloud.yml [new file with mode: 0644]
sonar-project.properties [new file with mode: 0644]

diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml
new file mode 100644 (file)
index 0000000..20caa40
--- /dev/null
@@ -0,0 +1,30 @@
+name: Build
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    types: [opened, synchronize, reopened]
+jobs:
+  build:
+    name: Build
+    runs-on: ubuntu-latest
+    container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-3
+    env:
+      SONAR_SERVER_URL: "https://sonarcloud.io"
+      BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
+    steps:
+      - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+      - name: Run build-wrapper
+        run: |
+          mkdir build
+          cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Release -DBUILD_UPDATER=ON -DBUILD_TESTING=1
+          build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja
+      - name: Run sonar-scanner
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        run: |
+          sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644 (file)
index 0000000..133ebf8
--- /dev/null
@@ -0,0 +1,6 @@
+sonar.projectKey=nextcloud_desktop
+sonar.organization=nextcloud
+sonar.sources=src
+sonar.language=c++
+sonar.cfamily.cache.enabled=false
+sonar.cfamily.threads=2