Parcourir la source

Enable Sonarcloud

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Felix Weilbach il y a 4 ans
Parent
commit
51b6d5e28f
2 fichiers modifiés avec 36 ajouts et 0 suppressions
  1. 30 0
      .github/workflows/sonarcloud.yml
  2. 6 0
      sonar-project.properties

+ 30 - 0
.github/workflows/sonarcloud.yml

@@ -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 }}"

+ 6 - 0
sonar-project.properties

@@ -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