Merge pull request #3345 from jriwanek-forks/sonarcloud

Sonarcloud support and GHA fixes
This commit is contained in:
Jasmine Iwanek
2023-05-12 07:21:56 -04:00
committed by GitHub
3 changed files with 97 additions and 12 deletions

View File

@@ -30,6 +30,9 @@ jobs:
runs-on: windows-2022
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
defaults:
run:
shell: msys2 {0}
@@ -106,6 +109,11 @@ jobs:
- name: Checkout repository
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
run: >-
@@ -117,7 +125,16 @@ jobs:
-D STATIC_BUILD=${{ matrix.ui.static }}
- name: Build
run: cmake --build build
run: |
cmake --build build
- name: Run sonar-scanner
if: 0
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
run: cmake --install build
@@ -130,10 +147,12 @@ jobs:
llvm-windows:
name: "Windows vcpkg/LLVM (${{ matrix.ui.name }}, ${{ matrix.build.name }}, ${{ matrix.dynarec.name }}, ${{ matrix.target.name }})"
if: 0
runs-on: windows-2022
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite'
strategy:
@@ -209,6 +228,11 @@ jobs:
- name: Checkout repository
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
run: >
@@ -229,13 +253,24 @@ jobs:
- name: Reconfigure CMake
if: matrix.ui.qt == 'on'
run: cmake clean build
run: |
cmake clean 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
if: 0
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
run: cmake --install build
run: |
cmake --install build
- name: Upload artifact
uses: actions/upload-artifact@v3
@@ -248,6 +283,9 @@ jobs:
runs-on: ubuntu-22.04
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
strategy:
fail-fast: true
matrix:
@@ -295,6 +333,11 @@ jobs:
- name: Checkout repository
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
run: >-
@@ -305,10 +348,20 @@ jobs:
-D QT=${{ matrix.ui.qt }}
- 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
if: 0
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
run: cmake --install build
run: |
cmake --install build
- name: Upload artifact
uses: actions/upload-artifact@v3
@@ -321,6 +374,9 @@ jobs:
runs-on: macos-11
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
strategy:
fail-fast: true
matrix:
@@ -362,6 +418,11 @@ jobs:
- name: Checkout repository
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
run: >-
@@ -375,10 +436,20 @@ jobs:
-D OpenAL_ROOT=$(brew --prefix openal-soft)
- 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
if: 0
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
run: cmake --install build
run: |
cmake --install build
- name: Upload artifact
uses: actions/upload-artifact@v3

View File

@@ -129,8 +129,8 @@ jobs:
-D STATIC_BUILD=${{ matrix.ui.static }}
- name: Build
run: cmake --build build
run: |
cmake --build build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
@@ -212,7 +212,8 @@ jobs:
-D QT=${{ matrix.ui.qt }}
- name: Build
run: cmake --build build
run: |
cmake --build build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
@@ -290,7 +291,8 @@ jobs:
-D OpenAL_ROOT=$(brew --prefix openal-soft)
- name: Build
run: cmake --build build
run: |
cmake --build build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

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