-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d576e1f
commit 12d8ed3
Showing
1 changed file
with
46 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,77 +6,67 @@ on: | |
branches: [ "main", "fix*" ] | ||
|
||
env: | ||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
SCCACHE_GHA_ENABLED: "true" | ||
|
||
jobs: | ||
Test: | ||
runs-on: ${{ matrix.os }} | ||
name: ${{ matrix.config.os }} ${{ matrix.config.compiler }} | ||
runs-on: ${{ matrix.config.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- windows-2022 | ||
- ubuntu-24.04 | ||
- macos-14 | ||
compiler: | ||
- llvm | ||
- gcc | ||
include: | ||
- os: "windows-2022" | ||
compiler: "msvc" | ||
exclude: | ||
- os: "macos-14" | ||
compiler: "llvm" | ||
config: | ||
# Reference: https://github.com/actions/runner-images | ||
- { os: "ubuntu-24.04", compiler: "gcc", cmake_gen: "Ninja Multi-Config", cmake_cxx: "/usr/bin/g++-14", cmake_cxx_launcher: "ccache" } | ||
- { os: "ubuntu-24.04", compiler: "llvm", cmake_gen: Ninja Multi-Config, cmake_cxx: "/usr/lib/llvm-18/bin/clang++", cmake_cxx_launcher: "ccache" } | ||
# project won't compile using g++ on macos-15; can use macos-14 instead | ||
#- { os: "macos-15", compiler: "gcc", cmake_gen: "Ninja Multi-Config", cmake_cxx: "g++-14", cmake_cxx_launcher: "ccache" } | ||
- { os: "macos-14", compiler: "gcc", cmake_gen: "Ninja Multi-Config", cmake_cxx: "g++-14", cmake_cxx_launcher: "ccache" } | ||
- { os: "macos-15", compiler: "llvm", cmake_gen: "Ninja Multi-Config", cmake_cxx: "$(brew --prefix llvm@18)/bin/clang++", cmake_cxx_launcher: "ccache" } | ||
- { os: windows-2022, compiler: "msvc", cmake_gen: "Ninja Multi-Config", cmake_cxx: "cl", cmake_cxx_launcher: "sccache" } | ||
- { os: windows-2022, compiler: "llvm", cmake_gen: "Ninja Multi-Config", cmake_cxx: "clang++", cmake_cxx_launcher: "sccache" } | ||
- { os: windows-2022, compiler: "gcc", cmake_gen: "Ninja Multi-Config", cmake_cxx: "g++", cmake_cxx_launcher: "sccache" } | ||
#- { os: "macos-14", compiler: "llvm", cmake_gen: "Ninja Multi-Config", cmake_cxx: "clang++", cmake_cxx_launcher: "ccache" } | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
./build/ | ||
~/vcpkg | ||
~/.cache/vcpkg/archives | ||
${{ env.LOCALAPPDATA }}/vcpkg/archives | ||
${{ env.APPDATA }}/vcpkg/archives | ||
${{ env.XDG_CACHE_HOME }}/vcpkg/archives | ||
~/.cache/ccache | ||
~/.ccache | ||
~/.config/ccache | ||
~/Library/Caches/ccache | ||
${{ env.LOCALAPPDATA }}/ccache | ||
${{ env.XDG_CACHE_HOME }}/ccache | ||
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ env.BUILD_TYPE }}- | ||
- uses: actions/checkout@v4 | ||
|
||
# NOTE: This cache is faster for non-Windows builds than ccache, but it | ||
# may not work over time? It doesn't work well for Windows builds | ||
# Recommend: use ccache for non-Windows and sccache for Windows (ccache is | ||
# also flakey on Windows) | ||
# | ||
# - name: Cache (non-Windows) | ||
# if: runner.os != 'Windows' | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: | | ||
# ./build | ||
# key: ${{ runner.os }}-${{ matrix.config.compiler }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-${{ matrix.config.compiler }}-${{ env.BUILD_TYPE }}- | ||
|
||
- name: Cache (non-Windows) | ||
if: runner.os != 'Windows' | ||
uses: hendrikmuhs/[email protected] | ||
|
||
- name: Setup Cpp | ||
- name: Cache (Windows) | ||
if: runner.os == 'Windows' | ||
uses: mozilla-actions/[email protected] | ||
|
||
- name: Install C++ Tools | ||
uses: aminya/setup-cpp@v1 | ||
with: | ||
compiler: ${{ matrix.compiler }} | ||
vcvarsall: ${{ contains(matrix.os, 'windows') }} | ||
cmake: true | ||
vcvarsall: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} | ||
ninja: true | ||
vcpkg: false | ||
cppcheck: false | ||
clang-tidy: false | ||
|
||
- name: Configure CMake (non-Windows) | ||
if: runner.os != 'Windows' | ||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | ||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | ||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | ||
|
||
- name: Configure CMake (Windows) | ||
if: runner.os == 'Windows' | ||
run: cmake -B ${{github.workspace}}/build | ||
- name: Configure CMake | ||
run: cmake -B ./build -G "${{matrix.config.cmake_gen}}" -DCMAKE_CXX_COMPILER="${{matrix.config.cmake_cxx}}" -DCMAKE_CXX_COMPILER_LAUNCHER="${{matrix.config.cmake_cxx_launcher}}" | ||
|
||
- name: Build | ||
# Build your program with the given configuration | ||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
run: cmake --build ./build --config ${{env.BUILD_TYPE}} | ||
|
||
- name: Test | ||
working-directory: ${{github.workspace}}/build | ||
# Execute tests defined by the CMake configuration. | ||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | ||
working-directory: ./build | ||
run: ctest -C ${{env.BUILD_TYPE}} |