mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-21 12:35:52 +03:00
let sonarcloud takes automated tests into account and report coverage
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
parent
a10ffb1676
commit
7a6bc830dd
3 changed files with 26 additions and 10 deletions
14
.drone.yml
14
.drone.yml
|
@ -3,7 +3,7 @@ name: qt-5.15
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: cmake
|
- name: cmake
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -11,7 +11,7 @@ steps:
|
||||||
- cd /drone/build
|
- cd /drone/build
|
||||||
- cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
|
- cmake -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
|
||||||
- name: compile
|
- name: compile
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -19,7 +19,7 @@ steps:
|
||||||
- cd /drone/build
|
- cd /drone/build
|
||||||
- make -j$(nproc)
|
- make -j$(nproc)
|
||||||
- name: test
|
- name: test
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -47,7 +47,7 @@ name: qt-5.15-clang
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: cmake
|
- name: cmake
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -55,7 +55,7 @@ steps:
|
||||||
- cd /drone/build
|
- cd /drone/build
|
||||||
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
|
- cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=clang-10 -DCMAKE_CXX_COMPILER=clang++-10 -DCMAKE_BUILD_TYPE=Debug -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DECM_ENABLE_SANITIZERS=address -DCMAKE_CXX_FLAGS=-Werror ../src
|
||||||
- name: compile
|
- name: compile
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -63,7 +63,7 @@ steps:
|
||||||
- cd /drone/build
|
- cd /drone/build
|
||||||
- ninja
|
- ninja
|
||||||
- name: test
|
- name: test
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
@ -73,7 +73,7 @@ steps:
|
||||||
- chown -R test:test .
|
- chown -R test:test .
|
||||||
- su -c 'ASAN_OPTIONS=detect_leaks=0 xvfb-run ctest --output-on-failure' test
|
- su -c 'ASAN_OPTIONS=detect_leaks=0 xvfb-run ctest --output-on-failure' test
|
||||||
- name: clang-tidy
|
- name: clang-tidy
|
||||||
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-2
|
image: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
volumes:
|
volumes:
|
||||||
- name: build
|
- name: build
|
||||||
path: /drone/build
|
path: /drone/build
|
||||||
|
|
19
.github/workflows/sonarcloud.yml
vendored
19
.github/workflows/sonarcloud.yml
vendored
|
@ -9,7 +9,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-3
|
container: ghcr.io/nextcloud/continuous-integration-client:client-5.15-4
|
||||||
env:
|
env:
|
||||||
SONAR_SERVER_URL: "https://sonarcloud.io"
|
SONAR_SERVER_URL: "https://sonarcloud.io"
|
||||||
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
|
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
|
||||||
|
@ -27,11 +27,24 @@ jobs:
|
||||||
- name: Run build-wrapper
|
- name: Run build-wrapper
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
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
|
cd build
|
||||||
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja
|
cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10 -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DBUILD_COVERAGE=ON
|
||||||
|
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j 2
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
useradd -m -s /bin/bash test
|
||||||
|
chown -R test:test .
|
||||||
|
su -c 'xvfb-run ctest --output-on-failure --output-junit testResult.xml' test
|
||||||
|
- name: Generate coverage report
|
||||||
|
run: |
|
||||||
|
cd build
|
||||||
|
su -c 'ctest -T Coverage' test
|
||||||
- name: Run sonar-scanner
|
- name: Run sonar-scanner
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
cp sonar-project.properties build
|
||||||
|
cd build
|
||||||
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
sonar.projectKey=nextcloud_desktop
|
sonar.projectKey=nextcloud_desktop
|
||||||
sonar.organization=nextcloud
|
sonar.organization=nextcloud
|
||||||
|
sonar.projectBaseDir=..
|
||||||
sonar.sources=src
|
sonar.sources=src
|
||||||
sonar.exclusions=3rdparty/**
|
sonar.exclusions=3rdparty/**
|
||||||
sonar.language=c++
|
sonar.language=c++
|
||||||
sonar.cfamily.cache.enabled=false
|
sonar.cfamily.cache.enabled=false
|
||||||
|
sonar.sourceEncoding=UTF-8
|
||||||
sonar.cfamily.threads=2
|
sonar.cfamily.threads=2
|
||||||
|
sonar.cfamily.gcov.reportsPath=build/Testing/CoverageInfo
|
||||||
sonar.cfamily.cache.enabled=true,
|
sonar.cfamily.cache.enabled=true,
|
||||||
sonar.cfamily.cache.path=/cache/sonarcloud
|
sonar.cfamily.cache.path=/cache/sonarcloud
|
||||||
|
|
Loading…
Reference in a new issue