Update to build against main #181
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
# | |
# .github/workflows/build-on-windows.yml | |
# | |
# Copyright 2021 Jens A. Koch. | |
# SPDX-License-Identifier: BSL-1.0 | |
# This file is part of hikogui. | |
# | |
name: "Build on Windows" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# improve CI concurrency by automatically cancelling outdated jobs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
CMAKE_CXX_COMPILER: ["cl", "clang"] | |
PACKAGE_MANAGER: ["FetchContent", "vcpkg", "vcpkg:head"] | |
name: x64-windows ${{matrix.CMAKE_CXX_COMPILER}} ${{matrix.PACKAGE_MANAGER}} | |
# https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md | |
runs-on: windows-2022 | |
env: | |
MATRIX_ID: ${{matrix.CMAKE_CXX_COMPILER}}-${{matrix.PACKAGE_MANAGER}} | |
BUILD_DIR: ${{github.workspace}}\build | |
INSTALL_DIR: ${{github.workspace}}\install | |
VCPKG_DIR: ${{github.workspace}}\external\vcpkg | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: π½ Checkout Code | |
uses: actions/checkout@v4 # https://github.com/actions/checkout | |
# https://community.chocolatey.org/packages/ninja | |
# https://community.chocolatey.org/packages/ccache | |
- name: π½ Install Ninja | |
run: choco install ninja ccache | |
- name: π οΈ Setup Visual Studio Developer Command Prompt | |
uses: ilammy/msvc-dev-cmd@v1 | |
- name: π½ Install Vulkan SDK | |
uses: jakoch/[email protected] # https://github.com/jakoch/install-vulkan-sdk-action/ | |
with: | |
vulkan_version: latest | |
optional_components: com.lunarg.vulkan.vma | |
install_runtime: true | |
cache: true | |
stripdown: true | |
# Build Artifact | |
# --------------- | |
# The ECPACK artifact contains files for building a signed installer, including the "ecpack.json" manifest file. | |
# | |
# Naming Scheme: | |
# | |
# - $ECPACK_NAME : hikogui-hello-world-0.3.0-win64 | |
# | |
# When we package the ECPACK artifact: | |
# | |
# - ${{ECPACK_NAME}} is used to create a .json file and a storage directory with the suffix "-files" | |
# - ${{ECPACK_NAME}}-ecpack is used to name the final ecpack.zip file | |
# | |
- name: π Fetch version data & set build artifact names | |
shell: pwsh | |
run: | | |
$NAME=$(jq -r .name vcpkg.json).replace('-', '_') | |
$VERSION=$(jq -r .version vcpkg.json) | |
echo "ECPACK_NAME=$NAME-$VERSION-win64" >> $env:GITHUB_ENV | |
- name: π½ Checkout VCPKG Code | |
if: matrix.PACKAGE_MANAGER == 'vcpkg' || matrix.PACKAGE_MANAGER == 'vcpkg:head' | |
uses: actions/checkout@v4 # https://github.com/actions/checkout | |
with: | |
repository: microsoft/vcpkg | |
path: ${{env.VCPKG_DIR}} | |
- name: π οΈ Setup VCPKG | |
if: matrix.PACKAGE_MANAGER == 'vcpkg' || matrix.PACKAGE_MANAGER == 'vcpkg:head' | |
working-directory: ${{env.VCPKG_DIR}} | |
run: .\bootstrap-vcpkg.bat | |
- name: β CMake β Make Build Directory | |
shell: pwsh | |
run: mkdir "${{env.BUILD_DIR}}" | |
- name: β CMake β Configure (FetchContent) | |
if: matrix.PACKAGE_MANAGER == 'FetchContent' | |
working-directory: ${{env.BUILD_DIR}} | |
shell: pwsh | |
run: > | |
cmake | |
-G "Ninja Multi-Config" | |
"-DCMAKE_C_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_CXX_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_INSTALL_PREFIX=${{env.INSTALL_DIR}}" | |
"-DCMAKE_CONFIGURATION_TYPES=Debug;Release;RelWithDebInfo" | |
.. | |
- name: β CMake β Configure (vcpkg) | |
if: matrix.PACKAGE_MANAGER == 'vcpkg' | |
working-directory: ${{env.BUILD_DIR}} | |
shell: pwsh | |
run: > | |
cmake | |
-G "Ninja Multi-Config" | |
"-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_DIR}}\scripts\buildsystems\vcpkg.cmake" | |
"-DCMAKE_C_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_CXX_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_INSTALL_PREFIX=${{env.INSTALL_DIR}}" | |
"-DCMAKE_CONFIGURATION_TYPES=Debug;Release;RelWithDebInfo" | |
.. | |
- name: β CMake β Configure (vcpkg:head) | |
if: matrix.PACKAGE_MANAGER == 'vcpkg:head' | |
working-directory: ${{env.BUILD_DIR}} | |
shell: pwsh | |
env: | |
VCPKG_OVERLAY_PORTS: "${{github.workspace}}\\vcpkg-overlay\\" | |
run: > | |
cmake | |
-G "Ninja Multi-Config" | |
"-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_DIR}}\scripts\buildsystems\vcpkg.cmake" | |
"-DCMAKE_C_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_CXX_COMPILER=${{matrix.CMAKE_CXX_COMPILER}}" | |
"-DCMAKE_INSTALL_PREFIX=${{env.INSTALL_DIR}}" | |
"-DCMAKE_CONFIGURATION_TYPES=Debug;Release;RelWithDebInfo" | |
.. | |
- name: π CMake β Build Debug | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --build . --config Debug --parallel 1 | |
- name: π¦ CMake β Install Debug | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --install . --config Debug | |
- name: π CMake β Build RelWithDebInfo | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --build . --config RelWithDebInfo --parallel 1 | |
- name: π¦ CMake β Install RelWithDebInfo | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --install . --config RelWithDebInfo | |
- name: π CMake β Build Release | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --build . --config Release --parallel 1 | |
- name: π¦ CMake β Install Release | |
working-directory: ${{env.BUILD_DIR}} | |
run: cmake --install . --config Release | |
- name: π¦ CMake β Package | |
working-directory: ${{env.BUILD_DIR}} | |
run: | | |
cpack . | |
copy "${{env.ECPACK_NAME}}.json" "${{env.ECPACK_NAME}}-files\ecpack.json" | |
- name: π Upload Artifact β ECPACK | |
if: matrix.CMAKE_CXX_COMPILER == 'cl' && matrix.PACKAGE_MANAGER == 'FetchContent' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.ECPACK_NAME}}-ecpack | |
path: ${{env.BUILD_DIR}}\${{env.ECPACK_NAME}}-files\ |