From c874430e897e769d0c7d8c9cf58d3c9859471a7f Mon Sep 17 00:00:00 2001 From: Shi Han Date: Tue, 8 Sep 2026 09:15:43 +0800 Subject: [PATCH] Build C# explicitly for CodeQL --- .github/workflows/codeql-analysis.yml | 34 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index da0927c..9aa6999 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -23,7 +23,7 @@ on: jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} permissions: actions: read contents: read @@ -32,7 +32,13 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'csharp', 'python' ] + include: + - language: csharp + os: windows-latest + build-mode: manual + - language: python + os: ubuntu-latest + build-mode: none # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support @@ -45,6 +51,7 @@ jobs: uses: github/codeql-action/init@6f5948dfacef28e207b48d0905cf90c03365536d # v3 with: languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} # If you wish to specify custom queries, you can do so here or in a config file. # By default, queries listed here will override any specified in a config file. # Prefix the list here with "+" to use these queries and those in the config file. @@ -53,20 +60,21 @@ jobs: # queries: security-extended,security-and-quality - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@6f5948dfacef28e207b48d0905cf90c03365536d # v3 + - name: Set up NuGet + if: matrix.language == 'csharp' + uses: NuGet/setup-nuget@d105a947828025cd7a980103c35ba2bfae586d0f # v2 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + - name: Set up MSBuild + if: matrix.language == 'csharp' + uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2 - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + - name: Restore C# dependencies + if: matrix.language == 'csharp' + run: nuget restore Data/WebTable/WebTableProcessing/WebTableProcessing.sln -PackagesDirectory Data/WebTable/WebTableProcessing/packages -NonInteractive - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + - name: Build C# + if: matrix.language == 'csharp' + run: msbuild Data/WebTable/WebTableProcessing/WebTableProcessing.sln /m /p:Configuration=Release /p:Platform="Any CPU" - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@6f5948dfacef28e207b48d0905cf90c03365536d # v3