U/sgriffin/vs2026 #495
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "CodeQL Advanced" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| schedule: | |
| - cron: '47 1 * * 2' # Run at 1:47 on Tuesdays | |
| permissions: | |
| contents: read | |
| jobs: | |
| analyze: | |
| name: Analyze (${{ matrix.language }}) | |
| # Use VS 2026 preview runner (GA May 4, 2026, then switch to windows-2025) | |
| runs-on: windows-2025-vs2026 | |
| permissions: | |
| packages: read | |
| actions: read | |
| contents: read | |
| security-events: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - language: c-cpp | |
| build-mode: manual | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: 'recursive' | |
| - name: Install Windows 11 SDK (10.0.22621.0) | |
| shell: pwsh | |
| run: | | |
| $sdkPath = "${env:ProgramFiles(x86)}\Windows Kits\10\Include\10.0.22621.0" | |
| if (Test-Path $sdkPath) { | |
| Write-Host "Windows SDK 10.0.22621.0 already installed" | |
| exit 0 | |
| } | |
| Write-Host "Downloading Windows 11 SDK 10.0.22621.0..." | |
| $installer = "$env:TEMP\winsdksetup.exe" | |
| Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?linkid=2196241" -OutFile $installer | |
| Write-Host "Installing SDK (this may take a few minutes)..." | |
| $proc = Start-Process -FilePath $installer -ArgumentList "/features OptionId.DesktopCPPx64 OptionId.DesktopCPPx86 /quiet /norestart /log $env:TEMP\sdk_install.log" -Wait -PassThru | |
| Write-Host "Installer exit code: $($proc.ExitCode)" | |
| if (Test-Path $sdkPath) { | |
| Write-Host "Windows SDK 10.0.22621.0 installed successfully" | |
| } else { | |
| Write-Host "SDK install log:" | |
| Get-Content "$env:TEMP\sdk_install.log" -ErrorAction SilentlyContinue | Select-Object -Last 50 | |
| Write-Error "Windows SDK installation failed - path not found: $sdkPath" | |
| exit 1 | |
| } | |
| # Initializes the CodeQL tools for scanning. | |
| - name: Initialize CodeQL | |
| uses: github/codeql-action/init@v4 | |
| 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. | |
| # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | |
| # queries: security-extended,security-and-quality | |
| - name: Build for CodeQL | |
| shell: pwsh | |
| run: | | |
| $path = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath | |
| # Build Release_Unicode|x64 for CodeQL analysis | |
| & $path\MSBuild\Current\Bin\amd64\msbuild.exe /m /p:Configuration=Release_Unicode /p:Platform=x64 mfcmapi.sln | |
| - name: Perform CodeQL Analysis | |
| id: analyze | |
| uses: github/codeql-action/analyze@v4 | |
| with: | |
| category: "/language:${{matrix.language}}" | |
| - name: Upload CodeQL Analysis Results | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| path: ${{ steps.analyze.outputs.sarif-output }} |