Add support for sonarcloud

This commit is contained in:
Jasmine Iwanek
2023-05-12 00:41:45 -04:00
parent 30ee268869
commit e524b75352
2 changed files with 86 additions and 8 deletions

View File

@@ -30,6 +30,9 @@ jobs:
runs-on: windows-2022 runs-on: windows-2022
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
defaults: defaults:
run: run:
shell: msys2 {0} shell: msys2 {0}
@@ -106,6 +109,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Configure CMake - name: Configure CMake
run: >- run: >-
@@ -117,7 +125,15 @@ jobs:
-D STATIC_BUILD=${{ matrix.ui.static }} -D STATIC_BUILD=${{ matrix.ui.static }}
- name: Build - name: Build
run: cmake --build build run: |
build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Generate package - name: Generate package
run: cmake --install build run: cmake --install build
@@ -134,6 +150,7 @@ jobs:
runs-on: windows-2022 runs-on: windows-2022
env: env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
strategy: strategy:
@@ -209,6 +226,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Configure CMake - name: Configure CMake
run: > run: >
@@ -229,13 +251,23 @@ jobs:
- name: Reconfigure CMake - name: Reconfigure CMake
if: matrix.ui.qt == 'on' if: matrix.ui.qt == 'on'
run: cmake clean build run: |
cmake clean build
- name: Build - name: Build
run: cmake --build build run: |
build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Generate package - name: Generate package
run: cmake --install build run: |
cmake --install build
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -248,6 +280,9 @@ jobs:
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
@@ -295,6 +330,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Configure CMake - name: Configure CMake
run: >- run: >-
@@ -305,10 +345,19 @@ jobs:
-D QT=${{ matrix.ui.qt }} -D QT=${{ matrix.ui.qt }}
- name: Build - name: Build
run: cmake --build build run: |
build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Generate package - name: Generate package
run: cmake --install build run: |
cmake --install build
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -321,6 +370,9 @@ jobs:
runs-on: macos-11 runs-on: macos-11
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
strategy: strategy:
fail-fast: true fail-fast: true
matrix: matrix:
@@ -362,6 +414,11 @@ jobs:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v1
- name: Configure CMake - name: Configure CMake
run: >- run: >-
@@ -375,10 +432,19 @@ jobs:
-D OpenAL_ROOT=$(brew --prefix openal-soft) -D OpenAL_ROOT=$(brew --prefix openal-soft)
- name: Build - name: Build
run: cmake --build build run: |
build-wrapper-macosx-x86 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
- name: Generate package - name: Generate package
run: cmake --install build run: |
cmake --install build
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3

12
sonar-project.properties Normal file
View File

@@ -0,0 +1,12 @@
sonar.projectKey=86Box_86Box
sonar.organization=86Box
# This is the name and version displayed in the SonarCloud UI.
#sonar.projectName=86Box
#sonar.projectVersion=1.0
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
#sonar.sources=.
# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8