From e524b75352862375e34745cf1226b0456f088800 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 12 May 2023 00:41:45 -0400 Subject: [PATCH 1/5] Add support for sonarcloud --- .github/workflows/cmake.yml | 82 +++++++++++++++++++++++++++++++++---- sonar-project.properties | 12 ++++++ 2 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 sonar-project.properties diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 9041ca0fc..ab9cf96c7 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -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,15 @@ jobs: -D STATIC_BUILD=${{ matrix.ui.static }} - 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 run: cmake --install build @@ -134,6 +150,7 @@ jobs: 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 +226,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 +251,23 @@ 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 + 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 +280,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 +330,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 +345,19 @@ 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 + 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 +370,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 +414,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 +432,19 @@ 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 + 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 diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 000000000..9011c9954 --- /dev/null +++ b/sonar-project.properties @@ -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 From aa9e88587628234c79aaf58de9094975fad4fed8 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 12 May 2023 01:02:03 -0400 Subject: [PATCH 2/5] Temporary till I figure out the problem with msys2 --- .github/workflows/cmake.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index ab9cf96c7..80abcf79b 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -126,9 +126,10 @@ jobs: - name: Build run: | - build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build + cmake --build build - name: Run sonar-scanner + if: 0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 7200fc1b4e7725d3531e2210c2225306d3238d95 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 12 May 2023 02:29:29 -0400 Subject: [PATCH 3/5] Disable running sonarcloud for now --- .github/workflows/cmake.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 80abcf79b..df09442e9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -260,6 +260,7 @@ jobs: 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 }} @@ -350,6 +351,7 @@ jobs: 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 }} @@ -437,6 +439,7 @@ jobs: 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 }} From cde2f87213ee40a07c72c7c36c7a916737a20880 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 12 May 2023 02:33:34 -0400 Subject: [PATCH 4/5] Disable LLVM builds till we can fix them properly --- .github/workflows/cmake.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index df09442e9..3d8e477dd 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -147,6 +147,7 @@ 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 From 248741ddbcbe1b1927e3c8af430390fae8e5aa9c Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Fri, 12 May 2023 02:39:45 -0400 Subject: [PATCH 5/5] Consistancy for GHA scripts --- .github/workflows/codeql.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 107755af6..69c877776 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -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