Add sonarcloud #206
Workflow file for this run
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: Pull request checks | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| pull_request: | |
| runs-on: windows-latest | |
| timeout-minutes: 10 | |
| env: | |
| BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory | |
| GYP_MSVS_VERSION: 2022 | |
| WINDOWS_SDK_VERSION: 10.0.26100.0 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - run: dir "C:\Program Files (x86)\Windows Kits\10\Lib" | |
| - name: Install Windows build tools | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Install Windows SDK 10.0.22621.0 | |
| shell: pwsh | |
| run: | | |
| # Install the Windows SDK 10.0.22621.0 using Visual Studio Installer | |
| $ErrorActionPreference = "Stop" | |
| # Check if Visual Studio Installer exists | |
| $vsInstaller = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vs_installer.exe" | |
| if (-Not (Test-Path $vsInstaller)) { | |
| Write-Host "Downloading Visual Studio Installer..." | |
| Invoke-WebRequest -Uri "https://aka.ms/vs/18/release/vs_installer.exe" -OutFile "$env:TEMP\vs_installer.exe" | |
| $vsInstaller = "$env:TEMP\vs_installer.exe" | |
| } | |
| # Install the Windows SDK workload | |
| & $vsInstaller modify ` | |
| --add Microsoft.VisualStudio.Component.Windows10SDK.22621 ` | |
| --quiet ` | |
| --norestart ` | |
| --wait | |
| - name: Verify Windows SDK | |
| shell: pwsh | |
| run: | | |
| Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0" | |
| Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0" | |
| - run: dir "C:\Program Files (x86)\Windows Kits\10\Lib" | |
| - name: Install node-gyp | |
| run: npm install -g node-gyp | |
| - name: Install build wrapper | |
| uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5 | |
| - name: Run build wrapper | |
| run: node-gyp configure build | |
| - run: ls ${{ env.BUILD_WRAPPER_OUT_DIR }} | |
| - run: cat ${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json | |
| - run: cat ${{ env.BUILD_WRAPPER_OUT_DIR }}/build-wrapper.log | |
| - run: cat ${{ env.BUILD_WRAPPER_OUT_DIR }}/build-wrapper-dump.json | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@v5 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| with: | |
| args: > | |
| --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" |