From 1f611ea20131ed4032a9623e7aaf18c86064e7b9 Mon Sep 17 00:00:00 2001 From: Henric Jungheim Date: Mon, 9 Jan 2023 17:11:46 -0700 Subject: [PATCH] CI: Add msvc-scan.yml GitHUb workflow (MSVC Analysis). --- .github/workflows/msvc-scan.yml | 70 +++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/msvc-scan.yml diff --git a/.github/workflows/msvc-scan.yml b/.github/workflows/msvc-scan.yml new file mode 100644 index 00000000..f8b9e3f6 --- /dev/null +++ b/.github/workflows/msvc-scan.yml @@ -0,0 +1,70 @@ +name: MSVC Scan + +# We only want to test official release code, not every pull request. +on: + push: + branches: [master] + +env: + libbinio_PRESET: default + libbinio_ROOT: '${{github.workspace}}/libbinio/out/install/default/lib/cmake/libbinio/' + +jobs: + analyze: + runs-on: windows-latest + + steps: + - name: Find libbinio repository + shell: bash + run: echo LIBBINIO_REPOSITORY="${GITHUB_REPOSITORY%/adplug}/libbinio" >> $GITHUB_ENV + + - name: Get cmake and ninja + uses: lukka/get-cmake@latest + + - name: Find MSVC (on Windows) + uses: ilammy/msvc-dev-cmd@v1 + + - name: Checkout libbinio repository + uses: actions/checkout@v3 + with: + repository: '${{env.LIBBINIO_REPOSITORY}}' + ref: master + path: libbinio + fetch-depth: 0 + + - name: Checkout adplug repository + uses: actions/checkout@v3 + with: + path: adplug + fetch-depth: 0 + + - name: Build libbinio + uses: lukka/run-cmake@v10 + with: + cmakeListsTxtPath: libbinio/CMakeLists.txt + configurePreset: '${{env.libbinio_PRESET}}' + buildPreset: '${{env.libbinio_PRESET}}' + + - name: Install libbinio + working-directory: 'libbinio/out/build/${{env.libbinio_PRESET}}/' + run: cmake --install . + + - name: Configure adplug + uses: lukka/run-cmake@v10 + with: + configurePreset: default + + - name: Initialize MSVC Code Analysis + uses: microsoft/msvc-code-analysis-action@v0.1.1 + # Provide a unique ID to access the sarif output path + id: run-analysis + with: + cmakeBuildDirectory: out/build/default + # Ruleset file that will determine what checks will be run + ruleset: NativeRecommendedRules.ruleset + + # Upload SARIF file to GitHub Code Scanning Alerts + - name: Upload SARIF to GitHub + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: ${{steps.run-analysis.outputs.sarif}}