blob: c4b61843c37cebccd1236622ab5fd4cd778231c8 [file] [log] [blame] [edit]
name: ci
on: push
permissions:
contents: read
jobs:
build:
strategy:
matrix:
container: [ ubuntu-latest, macos-latest, windows-latest ]
build_type: [ Debug, Release ]
# When updating the CMake version, make sure to also update the CMakeLists.txt.
cmake_version: ["3.15", "4.0.1", latest, latestrc]
include:
- container: windows-2019
cmake_version: "3.15"
build_type: Debug
- container: windows-2019
cmake_version: "3.15"
build_type: Release
exclude:
- container: windows-latest
cmake_version: "3.15"
runs-on: ${{ matrix.container }}
name: ${{ matrix.container }} - ${{ matrix.build_type }} - CMake ${{ matrix.cmake_version }}
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up CMake
uses: lukka/get-cmake@2ecc21724e5215b0e567bc399a2602d2ecb48541 # v4.02
with:
cmakeVersion: ${{ matrix.cmake_version }}
- name: Check for cmake warnings
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p build-warning
cd build-warning
cmake -S .. 2>&1 | tee cmake-warnings.log
# Check for warnings in the log file.
if grep -q "CMake Warning" cmake-warnings.log; then
echo "CMake warnings found!"
cat cmake-warnings.log
exit 1
fi
- name: Configure
shell: bash
# Configure CMake in a 'buildX' subdirectory.
# We can't use `build` as `BUILD` is already taken by the bazel build file.
# On Mac and Windows this leads to a conflict.
run: |
mkdir -p buildX
cd buildX
cmake \
-DBUILD_TESTING=ON \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}/install_dir \
-DBUILD_SHARED_LIBS=ON \
..
- name: Build shared
run: |
cmake --build buildX --config ${{ matrix.build_type }}
- name: Install shared
run: |
cmake --install buildX --config ${{ matrix.build_type }}
- name: Build static
run: |
cmake -DBUILD_SHARED_LIBS=OFF buildX
cmake --build buildX --config ${{ matrix.build_type }}
- name: Install static
run: |
cmake --install buildX --config ${{ matrix.build_type }}
- name: Test
if: runner.os != 'Windows'
working-directory: ${{ github.workspace }}/buildX
# Execute all tests.
run: |
ctest
# Also run the tests directly, just in case we forgot to add it to ctest.
test/cctest/cctest
- name: Test - Windows
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}/buildX
# Execute all tests.
run: |
ctest -C ${{ matrix.build_type }}
# Also run the tests directly, just in case we forgot to add it to ctest.
test/cctest/${{ matrix.build_type }}/cctest.exe