Skip to content

CMake

CMake #2289

Workflow file for this run

#
# Copyright 2023 Antony Peacock
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
# persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
# Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
name: CMake
on:
schedule:
- cron: "0 2 * * *" # Every day at 02:00 UTC
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.settings.name }} ${{ matrix.configuration }}
runs-on: ${{ matrix.settings.os }}
strategy:
matrix:
configuration: [ "Release", "Debug" ]
settings:
- {
name: "Ubuntu GCC-12",
os: ubuntu-latest,
compiler: { type: GCC, version: 12, conan: "gcc", cc: "gcc-12", cxx: "g++-12", std: 20 },
lib: "libstdc++11"
}
- {
name: "Ubuntu GCC-13",
os: ubuntu-latest,
compiler: { type: GCC, version: 13, conan: "gcc", cc: "gcc-13", cxx: "g++-13", std: 23 },
lib: "libstdc++11"
}
- {
name: "Ubuntu GCC-14",
os: ubuntu-latest,
compiler: { type: GCC, version: 14, conan: "gcc", cc: "gcc-14", cxx: "g++-14", std: 23 },
lib: "libstdc++11"
}
- {
name: "Ubuntu GCC-15",
os: ubuntu-latest,
compiler: { type: GCC, version: 15, conan: "gcc", cc: "gcc-15", cxx: "g++-15", std: 23 },
lib: "libstdc++11"
}
- {
name: "Ubuntu Clang-15 + libc++",
os: ubuntu-22.04,
compiler:
{
type: CLANG,
version: 15,
conan: "clang",
cc: "clang-15",
cxx: "clang++-15",
std: 20
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-16 + libc++",
os: ubuntu-22.04,
compiler:
{
type: CLANG,
version: 16,
conan: "clang",
cc: "clang-16",
cxx: "clang++-16",
std: 20
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-17 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 17,
conan: "clang",
cc: "clang-17",
cxx: "clang++-17",
std: 20
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-18 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 18,
conan: "clang",
cc: "clang-18",
cxx: "clang++-18",
std: 23
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-19 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 19,
conan: "clang",
cc: "clang-19",
cxx: "clang++-19",
std: 23
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-20 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 20,
conan: "clang",
cc: "clang-20",
cxx: "clang++-20",
std: 23
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-21 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 21,
conan: "clang",
cc: "clang-21",
cxx: "clang++-21",
std: 23
},
lib: "libc++",
}
- {
name: "Visual Studio 2019",
os: windows-latest,
compiler: { type: VISUAL, version: 16, conan: "msvc", cc: "cl", cxx: "cl", std: 23 },
}
- {
name: "MacOS Apple Clang 15",
os: macos-14,
compiler:
{
type: APPLE_CLANG,
version: "15.3",
conan: "apple-clang",
cc: "clang",
cxx: "clang++",
std: 23
},
lib: "libc++",
}
- {
name: "MacOS Apple Clang 16",
os: macos-14,
compiler:
{
type: APPLE_CLANG,
version: "16.2",
conan: "apple-clang",
cc: "clang",
cxx: "clang++",
std: 23
},
lib: "libc++",
}
- {
name: "MacOS Apple Clang 17",
os: macos-15,
compiler:
{
type: APPLE_CLANG,
version: "16.4",
conan: "apple-clang",
cc: "clang",
cxx: "clang++",
std: 23
},
lib: "libc++",
}
steps:
- uses: actions/checkout@v6.0.2
- name: Install Compiler
uses: ./.github/actions/setup-compiler
with:
compiler-type: ${{ matrix.settings.compiler.type }}
compiler-version: ${{ matrix.settings.compiler.version }}
stdlib: ${{ matrix.settings.lib || '' }}
os: ${{ matrix.settings.os }}
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Cache Conan Restore
uses: ./.github/actions/conan-cache-restore
with:
os: ${{ matrix.settings.os }}
build-type: ${{ matrix.configuration }}
conan-compiler: ${{ matrix.settings.compiler.conan }}
compiler-version: ${{ matrix.settings.compiler.version }}
stdlib: ${{ matrix.settings.lib || '' }}
- name: Setup Conan
uses: ./.github/actions/setup-conan
with:
build-type: ${{ matrix.configuration }}
compiler-type: ${{ matrix.settings.compiler.type }}
compiler-version: ${{ matrix.settings.compiler.version }}
conan-compiler: ${{ matrix.settings.compiler.conan }}
stdlib: ${{ matrix.settings.lib || '' }}
cppstd: ${{ matrix.settings.compiler.std }}
generator: "Ninja Multi-Config"
- name: Conan Install
shell: bash
run: |
conan install "${{ github.workspace }}" --build missing -pr:b default
- name: Configure CMake (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
if exist build\generators\conanbuild.bat call build\generators\conanbuild.bat
cmake --preset ${{ env.CONAN_CONFIGURE_PRESET }} -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_BEHAVIOUR_SANITIZER=ON
- name: Configure CMake (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
cmake --preset ${{ env.CONAN_CONFIGURE_PRESET }} -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_BEHAVIOUR_SANITIZER=ON
- name: Build (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
if exist build\generators\conanbuild.bat call build\generators\conanbuild.bat
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }}
- name: Build (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
cmake --build --preset ${{ env.CONAN_BUILD_PRESET }}
- name: Test (Windows)
if: runner.os == 'Windows'
shell: cmd
run: |
if exist build\generators\conanbuild.bat call build\generators\conanbuild.bat
ctest --preset ${{ env.CONAN_BUILD_PRESET }} -LE GPU --output-on-failure
- name: Test (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
if [ -f build/generators/conanbuild.sh ]; then
source build/generators/conanbuild.sh
fi
ctest --preset ${{ env.CONAN_BUILD_PRESET }} -LE GPU --output-on-failure
- name: Cache Conan Save
uses: ./.github/actions/conan-cache-save