upgrading cpack options #330
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: CMake on Windows MSVC/Clang x64 | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| BUILD_DIR: "build" | |
| BUILD_DIR_RELEASE: "build_release" | |
| CLANG_VERSION: 21.1.1 | |
| LLVM_BIN: 'C:\Program Files\LLVM\bin' | |
| CLANG_PROFILE_PRESET: x64-ClangCL-Windows-Profile | |
| defaults: | |
| run: | |
| shell: pwsh # Set PowerShell as default shell for all steps | |
| jobs: | |
| build: | |
| runs-on: windows-2025 | |
| steps: | |
| - uses: actions/[email protected] | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| ################################################################################################################# | |
| ######################################## Prepare deps ########################################################### | |
| ################################################################################################################# | |
| - name: Install dependencies | |
| run: | | |
| ./scripts/windows/setup-dependencies.ps1 ` | |
| -ClangVersion ${{ env.CLANG_VERSION }} | |
| # this is necessary ... windows and paths ... | |
| - name: Push Clang and LLVM and Sccache to Path | |
| shell: pwsh | |
| run: | | |
| Add-Content -Path $Env:GITHUB_PATH -Value 'C:\Program Files\LLVM\bin' | |
| Write-Output "$env:USERPROFILE\scoop\shims" >> $env:GITHUB_PATH | |
| ################################################################################################################# | |
| ####################### Run unit/integration/coverage/tests/static analyzers #################################### | |
| ################################################################################################################# | |
| ########################################## MSVC ################################################################# | |
| - name: Configure/Build CMake Debug (MSVC) | |
| run: | | |
| cmake -B "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-MSVC-Windows-Debug | |
| cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-MSVC-Windows-Debug | |
| - name: Test (MSVC) | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: ctest | |
| ########################################## CLANG-CL ############################################################# | |
| # | |
| - name: Prepare for Clang | |
| run: | | |
| Remove-Item -Path "${{ github.workspace }}/${{ env.BUILD_DIR }}" -Recurse -Force | |
| clang --version | |
| shell: pwsh | |
| - name: Configure CMake Build Debug (Clang) | |
| # cppcheck has a weired bug in windows-2025 ... at least last time i tested so turn it off for now | |
| run: | | |
| cmake -B "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-ClangCL-Windows-Debug -Dmyproject_ENABLE_CPPCHECK=OFF | |
| cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-ClangCL-Windows-Debug | |
| - name: Test (Clang) | |
| working-directory: ${{ env.BUILD_DIR }} | |
| run: | | |
| ctest | |
| & "llvm-profdata.exe" merge -sparse "Test\compile\default.profraw" -o "${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata" | |
| & "llvm-cov.exe" report "compileTestSuite.exe" -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata" | |
| & "llvm-cov.exe" export "compileTestSuite.exe" -format=text -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata" | Out-File -FilePath "coverage.json" -Encoding UTF8 | |
| & "llvm-cov.exe" show "compileTestSuite.exe" -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata" | |
| - name: Run clang-tidy | |
| shell: pwsh | |
| continue-on-error: true | |
| run: | | |
| $sourceFiles = Get-ChildItem -Path "Src" -Recurse -Include "*.cpp", "*.cc" | ForEach-Object { $_.FullName } | |
| clang-tidy -p="./${{ env.BUILD_DIR }}/compile_commands.json" $sourceFiles | |
| - name: Run Clang static analysis (HTML) | |
| shell: pwsh | |
| continue-on-error: true | |
| run: | | |
| # HTML output (correct flag form) | |
| $sourceFiles = Get-ChildItem -Path "Src" -Recurse -Include "*.cpp", "*.cc" | ForEach-Object { $_.FullName } | |
| clang++ --analyze -DUSE_RUST=1 -Xanalyzer -analyzer-output=html $sourceFiles | |
| # | |
| - name: Run Clang static analysis (scan-build) | |
| shell: pwsh | |
| continue-on-error: true | |
| run: | | |
| New-Item -ItemType Directory -Path "scan-build-reports" -Force | |
| scan-build --use-analyzer="C:\Program Files\LLVM\bin\clang-cl.exe" -o scan-build-reports cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-ClangCL-Windows-Debug | |
| ################################################################################################################# | |
| ############################# Now run on performance benchmarking/profiling ##################################### | |
| ################################################################################################################# | |
| - name: Prepare for Profiling | |
| run: | | |
| clang --version | |
| shell: pwsh | |
| - name: Configure/build CMake for Profiling (select preset by compiler) | |
| shell: pwsh | |
| # cppcheck has weird bug | |
| run: | | |
| $PRESET = $env:CLANG_PROFILE_PRESET | |
| Write-Output "Using preset: $PRESET" | |
| cmake -B "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset "$PRESET" -Dmyproject_ENABLE_CPPCHECK=OFF | |
| cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset "$PRESET" | |
| - name: Run performance benchmarks | |
| working-directory: ${{ env.BUILD_DIR_RELEASE }} | |
| run: .\perfTestSuite.exe --benchmark_out=results.json --benchmark_out_format=json | |
| - name: Run Instrumentation-based PGO Clang/LLVM | |
| continue-on-error: true | |
| working-directory: ${{ env.BUILD_DIR_RELEASE }} | |
| run: | | |
| $Env:LLVM_PROFILE_FILE = "dummy.profraw" | |
| & ".\KataglyphisCppProject.exe" | |
| & "llvm-profdata.exe" merge -sparse "dummy.profraw" -o "dummy.profdata" | |
| & "llvm-cov.exe" show ".\KataglyphisCppProject.exe" -instr-profile="dummy.profdata" -format=text | |
| ################################################################################################################# | |
| ################################### Now run release and build package for clang ################################# | |
| ################################################################################################################# | |
| - name: Prepare for Release build | |
| run: | | |
| Remove-Item -Path "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" -Recurse -Force | |
| clang --version | |
| shell: pwsh | |
| - name: Configure and Build CMake for Release (ClangCL) | |
| run: | | |
| cmake -B "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset x64-ClangCL-Windows-Release -Dmyproject_ENABLE_CPPCHECK=OFF | |
| cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset x64-ClangCL-Windows-Release | |
| - name: Package (Clang) | |
| run: cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset x64-ClangCL-Windows-Release --target package | |
| - name: Upload Installers & Zip | |
| uses: actions/[email protected] | |
| with: | |
| name: windows-installers | |
| path: | | |
| ${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}/*.msi | |
| ${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}/*.exe | |
| ${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}/*.zip |