std::formatter revised #112
This file contains 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 Windows' | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
env: | |
# https://github.com/Mozilla-Actions/sccache-action | |
SCCACHE_GHA_ENABLED: "true" | |
# 3GB; 10GB total for 4 compile jobs and conan data | |
SCCACHE_CACHE_SIZE : 3G | |
jobs: | |
# Note: [GHA Default environment variables](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#default-environment-variables) | |
Windows: | |
name: Windows ${{ matrix.cmake.configure_preset }} | |
runs-on: ${{ matrix.image }} | |
strategy: | |
fail-fast: false | |
matrix: | |
image: [ windows-2022 ] | |
os: [ windows ] | |
cmake: | |
- { | |
compiler: "cl", | |
conan_profile: "msvc", | |
configure_preset: "msvc", | |
build_preset: "msvc-release", | |
test_preset: "msvc-release-test", | |
vcvars: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" | |
} | |
- { | |
compiler: "clang-cl", | |
conan_profile: "msvc-cl", | |
configure_preset: "msvc-cl", | |
build_preset: "msvc-cl-release", | |
test_preset: "msvc-cl-release-test", | |
vcvars: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat" | |
} | |
steps: | |
- name: Trigger event | |
run: | | |
echo "Triggered by ${{ github.event_name }}" | |
- name: Install required build dependencies on ${{ matrix.image }} | |
# https://github.com/actions/runner-images/blob/main/images/windows/Windows2022-Readme.md | |
run: | | |
choco install ninja doxygen.portable | |
# choco install conan --params "/PathType:'Machine'" # PATH doesn't work with pwsh | |
# [Add-Content](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-content?view=powershell-7.2) | |
# Add-Content $env:GITHUB_PATH "C:\Program Files\Conan\conan" | |
# pipx install virtualenv # Windows 2022 image, based on Python 3.9!!, match statements are a feature of Python 3.10 | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set Github runner's env (CXX=${{ matrix.cmake.compiler }}) | |
shell: cmd | |
run: | | |
echo "CXX=${{ matrix.cmake.compiler }}" >> $GITHUB_ENV | |
- name: Install conan package manager | |
id: conan2 | |
run: | | |
py -m venv .win64-venv | |
.\.win64-venv\Scripts\activate | |
py -m pip install conan | |
deactivate | |
- name: Cache Conan2 dependencies | |
id: conan2-cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ matrix.os }}-${{ matrix.cmake.conan_profile }}-conan-${{ hashFiles('conanfile.py') }} | |
path: | | |
C:\\Users\\runneradmin\\.conan2 | |
- name: Create Conan2 profile (default, ${{ matrix.cmake.conan_profile }}) | |
if: steps.conan2-cache.outputs.cache-hit != 'true' | |
run: | | |
.\.win64-venv\Scripts\activate | |
conan profile detect --force --name ${{ matrix.cmake.conan_profile }} | |
Copy-Item -Path $HOME\.conan2\profiles\${{ matrix.cmake.conan_profile }} -Destination $HOME\.conan2\profiles\default -Force | |
conan profile show -pr=${{ matrix.cmake.conan_profile }} | |
deactivate | |
- name: Setup Github cache for compiler cache (Mozilla sccache-cache) | |
uses: mozilla-actions/[email protected] | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
- name: Conan install | |
run: | | |
.win64-venv\Scripts\activate | |
py -m pip install multipledispatch | |
py conan_install.py --profile ${{ matrix.cmake.conan_profile }} | |
deactivate | |
- name: Show prerequisites | |
if: true | |
shell: cmd | |
run: | | |
call "${{ matrix.cmake.vcvars }}" | |
.\.win64-venv\Scripts\activate | |
# eval ${CXX} --version | |
conan list '*' | |
cmake --version | |
cmake --list-presets | |
deactivate | |
- name: CMake configuration | |
shell: cmd | |
env: | |
CMAKE_CXX_COMPILER_LAUNCHER: sccache | |
run: | | |
call "${{ matrix.cmake.vcvars }}" | |
cmake --preset ${{ matrix.cmake.configure_preset }} | |
- name: CMake build | |
shell: cmd | |
run: | | |
call "${{ matrix.cmake.vcvars }}" | |
cmake --build --preset ${{ matrix.cmake.build_preset }} | |
- name: Run Unit Test | |
continue-on-error: true | |
run: | | |
ctest --preset ${{ matrix.cmake.test_preset }} |