Clean up repo, use CPM for dependency management #60
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: skyr-url CI | |
# Trigger on pushes to all branches and for all pull-requests | |
on: [ push, pull_request ] | |
env: | |
CMAKE_VERSION: 3.21.7 | |
NINJA_VERSION: 1.11.0 | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# GCC-10 | |
- { | |
name: "Linux GCC 10 Debug (C++17)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: Debug, | |
cc: "gcc-10", cxx: "g++-10", | |
cxx_standard: 17 | |
} | |
- { | |
name: "Linux GCC 10 Release (C++17)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: RelWithDebInfo, | |
cc: "gcc-10", cxx: "g++-10", | |
cxx_standard: 17 | |
} | |
- { | |
name: "Linux GCC 10 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: Debug, | |
cc: "gcc-10", cxx: "g++-10", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Linux GCC 10 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: RelWithDebInfo, | |
cc: "gcc-10", cxx: "g++-10", | |
cxx_standard: 20, | |
} | |
# GCC-11 | |
- { | |
name: "Linux GCC 11 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: Debug, | |
cc: "gcc-11", cxx: "g++-11", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Linux GCC 11 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: RelWithDebInfo, | |
cc: "gcc-11", cxx: "g++-11", | |
cxx_standard: 20, | |
} | |
# # GCC-12 | |
# - { | |
# name: "Linux GCC 12 Debug (C++20)", artifact: "Linux.tar.xz", | |
# os: ubuntu-latest, | |
# build_type: Debug, | |
# cc: "gcc-12", cxx: "g++-12", | |
# cxx_standard: 20, | |
# } | |
# - { | |
# name: "Linux GCC 12 Release (C++20)", artifact: "Linux.tar.xz", | |
# os: ubuntu-latest, | |
# build_type: RelWithDebInfo, | |
# cc: "gcc-12", cxx: "g++-12", | |
# cxx_standard: 20, | |
# } | |
# Clang-10 | |
- { | |
name: "Linux Clang 10 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: Debug, | |
cc: "clang-10", cxx: "clang++-10", | |
cxx_standard: 20 | |
} | |
- { | |
name: "Linux Clang 10 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: RelWithDebInfo, | |
cc: "clang-10", cxx: "clang++-10", | |
cxx_standard: 20, | |
} | |
# Clang-11 | |
- { | |
name: "Linux Clang 11 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: Debug, | |
cc: "clang-11", cxx: "clang++-11", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Linux Clang 11 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: RelWithDebInfo, | |
cc: "clang-11", cxx: "clang++-11", | |
cxx_standard: 20, | |
} | |
# Clang-12 | |
- { | |
name: "Linux Clang 12 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: Debug, | |
cc: "clang-12", cxx: "clang++-12", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Linux Clang 12 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-20.04, | |
build_type: RelWithDebInfo, | |
cc: "clang-12", cxx: "clang++-12", | |
cxx_standard: 20, | |
} | |
# Clang-14 | |
- { | |
name: "Linux Clang 14 Debug (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: Debug, | |
cc: "clang-14", cxx: "clang++-14", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Linux Clang 14 Release (C++20)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
build_type: RelWithDebInfo, | |
cc: "clang-14", cxx: "clang++-14", | |
cxx_standard: 20, | |
} | |
# AppleClang | |
- { | |
name: "macOS Clang Debug (C++17)", artifact: "macOS.tar.xz", | |
os: macos-latest, | |
build_type: Debug, | |
cc: "clang", cxx: "clang++", | |
cxx_standard: 17 | |
} | |
- { | |
name: "macOS Clang Release (C++17)", artifact: "macOS.tar.xz", | |
os: macos-latest, | |
build_type: RelWithDebInfo, | |
cc: "clang", cxx: "clang++", | |
cxx_standard: 17, | |
} | |
- { | |
name: "macOS Clang Debug (C++20)", artifact: "macOS.tar.xz", | |
os: macos-latest, | |
build_type: Debug, | |
cc: "clang", cxx: "clang++", | |
cxx_standard: 20 | |
} | |
- { | |
name: "macOS Clang Release (C++20)", artifact: "macOS.tar.xz", | |
os: macos-latest, | |
build_type: RelWithDebInfo, | |
cc: "clang", cxx: "clang++", | |
cxx_standard: 20, | |
} | |
# MSVC 2019 | |
- { | |
name: "Windows MSVC 2019 Debug (C++17)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: Debug, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 17, | |
} | |
- { | |
name: "Windows MSVC 2019 Release (C++17)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: RelWithDebInfo, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 17, | |
} | |
- { | |
name: "Windows MSVC 2019 Debug (C++20)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: Debug, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Windows MSVC 2019 Release (C++20)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: RelWithDebInfo, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 20, | |
} | |
# MSVC 2022 | |
- { | |
name: "Windows MSVC 2022 Debug (C++20)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: Debug, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 20, | |
} | |
- { | |
name: "Windows MSVC 2022 Release (C++20)", artifact: "Windows-MSVC.tar.xz", | |
os: windows-latest, | |
build_type: RelWithDebInfo, | |
cc: "cl", cxx: "cl", | |
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat", | |
cxx_standard: 20, | |
} | |
steps: | |
- uses: actions/checkout@master | |
- uses: seanmiddleditch/gha-setup-vsdevenv@master | |
- name: Download Ninja and CMake | |
id: cmake_and_ninja | |
shell: cmake -P {0} | |
run: | | |
set(cmake_version $ENV{CMAKE_VERSION}) | |
set(ninja_version $ENV{NINJA_VERSION}) | |
message(STATUS "Using host CMake version: ${CMAKE_VERSION}") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(ninja_suffix "win.zip") | |
set(cmake_suffix "windows-x86_64.zip") | |
set(cmake_dir "cmake-${cmake_version}-windows-x86_64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "Linux") | |
set(ninja_suffix "linux.zip") | |
set(cmake_suffix "linux-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-linux-x86_64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(ninja_suffix "mac.zip") | |
set(cmake_suffix "macos10.10-universal.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-macos10.10-universal/CMake.app/Contents/bin") | |
endif() | |
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) | |
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") | |
file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) | |
# Save the path for other steps | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) | |
message("::set-output name=cmake_dir::${cmake_dir}") | |
execute_process( | |
COMMAND chmod +x ninja | |
COMMAND chmod +x ${cmake_dir}/cmake | |
) | |
- name: Install GCC 7 | |
id: install_gcc_7 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-7' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install g++-7 | |
- name: Install GCC 8 | |
id: install_gcc_8 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-8' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install g++-8 | |
- name: Install GCC 11 | |
id: install_gcc_11 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-11' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install g++-11 | |
# - name: Install GCC 12 | |
# id: install_gcc_12 | |
# if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'g++-12' ) | |
# shell: bash | |
# working-directory: ${{ env.HOME }} | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get -y install g++-12 | |
- name: Install Clang 8 | |
id: install_clang_8 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-8' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install clang-8 | |
- name: Install Clang 10 | |
id: install_clang_10 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-10' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 10 | |
- name: Install Clang 11 | |
id: install_clang_11 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-11' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 11 | |
sudo apt-get install -y libc++-11-dev libc++abi-11-dev | |
- name: Install Clang 12 | |
id: install_clang_12 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-12' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 12 | |
sudo apt-get install -y libc++-12-dev libc++abi-12-dev libunwind-12-dev | |
- name: Install Clang 14 | |
id: install_clang_14 | |
if: startsWith(matrix.config.os, 'ubuntu') && ( matrix.config.cxx == 'clang++-14' ) | |
shell: bash | |
working-directory: ${{ env.HOME }} | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 14 | |
- name: Install vcpkg (Linux) | |
id: vcpkg_linux | |
if: startsWith(matrix.config.os, 'ubuntu') | |
shell: bash | |
run: | | |
mkdir -p ${GITHUB_WORKSPACE}/vcpkg | |
cd ${GITHUB_WORKSPACE}/vcpkg | |
git init | |
git remote add origin https://github.com/microsoft/vcpkg.git | |
git fetch origin master | |
git checkout -b master origin/master | |
export | |
./bootstrap-vcpkg.sh | |
./vcpkg install fmt | |
- name: Install vcpkg (MacOS) | |
id: vcpkg_macos | |
if: startsWith(matrix.config.os, 'macos') | |
shell: bash | |
run: | | |
brew install pkg-config | |
mkdir -p ${GITHUB_WORKSPACE}/vcpkg | |
cd ${GITHUB_WORKSPACE}/vcpkg | |
git init | |
git remote add origin https://github.com/microsoft/vcpkg.git | |
git fetch origin master | |
git checkout -b master origin/master | |
export | |
./bootstrap-vcpkg.sh | |
./vcpkg install fmt | |
- name: Install vcpkg (Windows) | |
id: vcpkg_windows | |
if: startsWith(matrix.config.os, 'windows') | |
shell: powershell | |
run: | | |
git clone https://github.com/microsoft/vcpkg.git ${Env:GITHUB_WORKSPACE}\vcpkg | |
cd ${Env:GITHUB_WORKSPACE}\vcpkg | |
.\bootstrap-vcpkg.bat | |
vcpkg install fmt --triplet x64-windows | |
- name: Configure | |
shell: cmake -P {0} | |
working-directory: ${{ env.HOME }} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
execute_process( | |
COMMAND "${{ matrix.config.environment_script }}" && set | |
OUTPUT_FILE environment_script_output.txt | |
) | |
set(cxx_flags "/permissive- /EHsc") | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
set(path_separator ":") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(path_separator ";") | |
endif() | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
set(BUILD_V2 OFF) | |
if ("${{ matrix.config.name }}" STREQUAL "Windows MSVC 2019 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Windows MSVC 2019 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Windows MSVC 2022 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Windows MSVC 2022 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux GCC 11 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux GCC 11 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux GCC 12 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux GCC 12 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Release (C++20)" | |
) | |
set(BUILD_V2 ON) | |
endif() | |
set(USE_LLVM OFF) | |
if("${{ matrix.config.name }}" STREQUAL "macOS Clang Debug (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "macOS Clang Release (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "macOS Clang Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "macOS Clang Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Debug (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Release (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Debug (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Release (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Debug (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Release (C++17)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 11 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 12 Release (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Debug (C++20)" OR | |
"${{ matrix.config.name }}" STREQUAL "Linux Clang 14 Release (C++20)" | |
) | |
set(USE_LLVM ON) | |
endif() | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake | |
-S . | |
-B build | |
-G Ninja | |
-D CMAKE_CXX_STANDARD:STRING=${{ matrix.config.cxx_standard }} | |
-D skyr_WARNINGS_AS_ERRORS=OFF | |
-D skyr_BUILD_TESTS=ON | |
-D skyr_BUILD_DOCS=OFF | |
-D skyr_BUILD_EXAMPLES=OFF | |
-D skyr_BUILD_V2=${BUILD_V2} | |
-D skyr_BUILD_WITH_LLVM_LIBCXX=${USE_LLVM} | |
-D SKY_VERBOSE_BUILD=ON | |
-D CMAKE_BUILD_TYPE=${{ matrix.config.build_type }} | |
-D CMAKE_INSTALL_PREFIX=$ENV{GITHUB_WORKSPACE}/install | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build | |
shell: cmake -P {0} | |
working-directory: ${{ env.HOME }} | |
continue-on-error: ${{ matrix.config.experimental || false }} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") | |
file(STRINGS environment_script_output.txt output_lines) | |
foreach(line IN LISTS output_lines) | |
if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") | |
set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") | |
endif() | |
endforeach() | |
endif() | |
set(path_separator ":") | |
if ("${{ runner.os }}" STREQUAL "Windows") | |
set(path_separator ";") | |
endif() | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Run tests | |
shell: cmake -P {0} | |
working-directory: ${{ env.HOME }} | |
continue-on-error: ${{ matrix.config.experimental || false }} | |
run: | | |
include(ProcessorCount) | |
ProcessorCount(N) | |
set(ENV{CTEST_OUTPUT_ON_FAILURE} "ON") | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build --target test | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Running tests failed!") | |
endif() | |
- name: Install | |
shell: cmake -P {0} | |
working-directory: ${{ env.HOME }} | |
continue-on-error: ${{ matrix.config.experimental || false }} | |
run: | | |
execute_process( | |
COMMAND ${{ steps.cmake_and_ninja.outputs.cmake_dir }}/cmake --build build --target install | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Install failed!") | |
endif() |