Skip to content

Update Tests.cmake #616

Update Tests.cmake

Update Tests.cmake #616

Workflow file for this run

name: Windows Server 2025 build x86 MSVC and Clang
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
BUILD_DIR: build
BUILD_DIR_RELEASE: build_release
VULKAN_VERSION: 1.4.321.1
CLANG_VERSION: 21.1.1
VULKAN_SDK_PATH: C:\VulkanSDK
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2025
# env:
# VULKAN_SDK: C:\VulkanSDK\
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: recursive
#################################################################################################################
######################################## Prepare deps ###########################################################
#################################################################################################################
- name: Install Windows Dependencies
shell: pwsh
run: |
./Scripts/Windows/setup-dependencies.ps1 `
-VulkanVersion ${{ env.VULKAN_VERSION }} `
-ClangVersion ${{ env.CLANG_VERSION }} `
-VulkanSdkPath '${{ env.VULKAN_SDK_PATH }}'
# - name: Add NSIS to PATH
# run: |
# echo "C:\Program Files (x86)\NSIS" >> $GITHUB_PATH
#################################################################################################################
####################### Run unit/integration/coverage/tests/static analyzers ####################################
#################################################################################################################
########################################## MSVC #################################################################
- name: CMake Build for MSVC
shell: powershell
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-MSVC-Windows-Debug" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR }}"
ctest
########################################## CLANG-CL #############################################################
# for now cppcehck is buggy on windows 2025 github runner. so disable
# a github runner has issues with running vulkan driver code; therefore just verify successful build :)
- name: Prepare for ClangCL Debug
run: |
Remove-Item -Path "${{github.workspace}}/${{ env.BUILD_DIR }}" -Recurse -Force
clang --version
- name: CMake Build for Clang
shell: powershell
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-ClangCL-Windows-Debug" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-ClangCL-Windows-Debug"
ctest
- 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="${{github.workspace}}/${{ 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 -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 -o scan-build-reports cmake --build "$env:WORKSPACE/$env:BUILD_DIR" --preset "$env:CLANG_DEBUG_PRESET"
#################################################################################################################
################################### Now run release and build package for clang #################################
#################################################################################################################
- name: Configure CMake for Release (Clang only)
# -DCPACK_GENERATOR=ZIP; NSIS has problems on github windows runner
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --preset "x64-ClangCL-Windows-Release" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
- name: Build Release (Clang only)
shell: pwsh
run: |
$env:CMAKE_BUILD_PARALLEL_LEVEL = $env:NUMBER_OF_PROCESSORS
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --preset "x64-ClangCL-Windows-Release" -DWINDOWS_CI=ON
- name: Package (Clang only)
run: |
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --target package --verbose
# I limited the size of the builded package for storage restriction reasons on a github runner
# see also the install commands in the bottom of the CMakeLists.txt
- 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