| name: Windows (CMake) |
| |
| on: |
| push: |
| branches: [ "*" ] |
| pull_request: |
| branches: [ "trunk" ] |
| |
| # Allows you to run this workflow manually from the Actions tab |
| workflow_dispatch: |
| |
| jobs: |
| build: |
| strategy: |
| fail-fast: false |
| matrix: |
| include: |
| - name: Windows x64 |
| os: windows-2022 |
| platform: x64 |
| triplet: x64-windows |
| generator: "Visual Studio 17 2022" |
| - name: Windows x86 |
| os: windows-2022 |
| platform: Win32 |
| triplet: x86-windows |
| generator: "Visual Studio 17 2022" |
| - name: Windows x64 |
| os: windows-latest |
| platform: x64 |
| triplet: x64-windows |
| generator: "Visual Studio 18 2026" |
| - name: Windows x86 |
| os: windows-latest |
| platform: Win32 |
| triplet: x86-windows |
| generator: "Visual Studio 18 2026" |
| |
| runs-on: ${{ matrix.os }} |
| |
| env: |
| VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" |
| |
| steps: |
| - name: Prepare Environment (Windows) |
| if: runner.os == 'Windows' |
| run: | |
| $root = &(Join-Path ${env:ProgramFiles(x86)} "\Microsoft Visual Studio\Installer\vswhere.exe") -property installationpath -latest |
| Import-Module (Join-Path $root "Common7\Tools\Microsoft.VisualStudio.DevShell.dll") |
| Enter-VsDevShell -VsInstallPath $root -DevCmdArguments "-arch=${{ matrix.arch }}" |
| |
| ls env: | foreach { "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV } |
| |
| - name: Export GitHub Actions cache environment variables |
| uses: actions/github-script@v7 |
| with: |
| script: | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| |
| - name: Restore vcpkg/installed from stash |
| uses: apache/infrastructure-actions/stash/restore@main |
| with: |
| key: 'vcpkg_installed_${{ matrix.triplet }}' |
| path: 'C:/vcpkg/installed/' |
| |
| - name: Install dependencies |
| run: vcpkg install --triplet ${{ matrix.triplet }} apr apr-util zlib openssl brotli |
| |
| - name: Save vcpkg/installed to stash for next run |
| uses: apache/infrastructure-actions/stash/save@main |
| with: |
| key: 'vcpkg_installed_${{ matrix.triplet }}' |
| path: 'C:/vcpkg/installed/' |
| |
| - uses: actions/checkout@v6 |
| |
| - name: Configure CMake |
| run: > |
| cmake |
| -B ${{github.workspace}}/build |
| -G "${{ matrix.generator }}" |
| -DCMAKE_GENERATOR_PLATFORM=${{ matrix.platform }} |
| -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake |
| -DCMAKE_PREFIX_PATH=C:/vcpkg/installed/${{ matrix.triplet }} |
| -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/install |
| |
| - name: Build (Release) |
| run: cmake --build ${{github.workspace}}/build --config Release -j |
| |
| - name: Build (Debug) |
| run: cmake --build ${{github.workspace}}/build --config Debug -j |
| |
| - name: Test (Release) |
| working-directory: ${{github.workspace}}/build |
| run: ctest -C Release --output-on-failure |
| |
| - name: Test (Debug) |
| working-directory: ${{github.workspace}}/build |
| run: ctest -C Debug --output-on-failure |