From 51b6d5e28f0e1c94f96e820ef3db58befc60507b Mon Sep 17 00:00:00 2001 From: Felix Weilbach Date: Fri, 1 Oct 2021 17:41:49 +0200 Subject: [PATCH] Enable Sonarcloud Signed-off-by: Felix Weilbach --- .github/workflows/sonarcloud.yml | 30 ++++++++++++++++++++++++++++++ sonar-project.properties | 6 ++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/sonarcloud.yml create mode 100644 sonar-project.properties diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 000000000..20caa404d --- /dev/null +++ b/.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 }}" diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..133ebf829 --- /dev/null +++ b/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