2021-10-14 16:29:47 +03:00
|
|
|
name: SonarCloud analysis
|
2021-10-01 18:41:49 +03:00
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
|
|
build:
|
2023-09-25 12:19:22 +03:00
|
|
|
name: SonarCloud analysis
|
2024-03-15 20:55:11 +03:00
|
|
|
runs-on: ubuntu-latest
|
2024-04-23 13:27:53 +03:00
|
|
|
container: ghcr.io/nextcloud/continuous-integration-client-qt6:client-6.6.3-2
|
2021-10-01 18:41:49 +03:00
|
|
|
env:
|
|
|
|
SONAR_SERVER_URL: "https://sonarcloud.io"
|
|
|
|
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
|
|
|
|
steps:
|
2023-10-25 12:25:03 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-10-01 18:41:49 +03:00
|
|
|
with:
|
|
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
2021-10-14 16:25:50 +03:00
|
|
|
|
|
|
|
- name: Restore cache
|
2024-01-23 02:51:53 +03:00
|
|
|
uses: actions/cache@v4
|
2021-10-14 16:25:50 +03:00
|
|
|
with:
|
|
|
|
path: /cache
|
|
|
|
key: ${{ runner.os }}
|
|
|
|
|
2021-10-01 18:41:49 +03:00
|
|
|
- name: Run build-wrapper
|
|
|
|
run: |
|
|
|
|
mkdir build
|
2021-10-18 13:09:22 +03:00
|
|
|
cd build
|
2024-04-10 09:58:03 +03:00
|
|
|
cmake .. -G Ninja -DCMAKE_PREFIX_PATH=/opt/qt6.6.3 -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 -DCMAKE_BUILD_TYPE=Debug -DQUICK_COMPILER=ON -DBUILD_UPDATER=ON -DBUILD_TESTING=1 -DQT_MAJOR_VERSION=6 -DCMAKE_CXX_FLAGS=-Werror -DOPENSSL_ROOT_DIR=/usr/local/lib64 -DBUILD_COVERAGE=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
2022-07-05 20:09:31 +03:00
|
|
|
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja
|
2021-10-18 13:09:22 +03:00
|
|
|
- name: Run tests
|
|
|
|
run: |
|
|
|
|
cd build
|
|
|
|
useradd -m -s /bin/bash test
|
|
|
|
chown -R test:test .
|
2024-03-15 20:55:11 +03:00
|
|
|
su -c 'xvfb-run ctest --output-on-failure --output-junit testResult.xml' test
|
2021-10-18 13:09:22 +03:00
|
|
|
- name: Generate coverage report
|
|
|
|
run: |
|
|
|
|
cd build
|
|
|
|
su -c 'ctest -T Coverage' test
|
2021-10-01 18:41:49 +03:00
|
|
|
- name: Run sonar-scanner
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
run: |
|
2021-10-18 13:09:22 +03:00
|
|
|
cp sonar-project.properties build
|
|
|
|
cd build
|
2021-10-01 18:41:49 +03:00
|
|
|
sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
|