Skip to content

Cmake

Cmake #419

Workflow file for this run

name: build
on:
push:
branches:
- master
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'LICENSE'
- 'Makefile'
- '**/README.md'
pull_request:
paths-ignore:
- '.devcontainer/**'
- '.vscode/**'
- 'LICENSE'
- 'Makefile'
- '**/README.md'
workflow_dispatch:
env:
CTEST_OUTPUT_ON_FAILURE: ON
CTEST_PARALLEL_LEVEL: 2
jobs:
test:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu 24.04 GCC, C++11 (Debug)",
os: ubuntu-24.04,
build_type: "Debug",
std: "11",
sanitizers: "ON",
}
- {
name: "Ubuntu Latest GCC, C++17 (Debug)",
os: ubuntu-latest,
build_type: "Debug",
std: "17",
sanitizers: "OFF",
}
- {
name: "Ubuntu Latest GCC, C++11 (Release)",
os: ubuntu-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
- {
name: "macOS Latest Clang, C++11 (Release)",
os: macos-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
- {
name: "Windows Latest, C++11 (Release)",
os: windows-latest,
build_type: "Release",
std: "11",
sanitizers: "OFF",
}
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -DCMAKE_CXX_STANDARD=${{ matrix.config.std }} -DCPP_CHANNEL_BUILD_EXAMPLES=ON -DCPP_CHANNEL_BUILD_TESTS=ON -DCPP_CHANNEL_SANITIZERS=${{ matrix.config.sanitizers }}
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{ matrix.config.build_type }} --target channel_tests -j
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{ matrix.config.build_type }} --verbose -L channel_tests --output-on-failure -j
- name: Run examples
working-directory: ${{github.workspace}}/build
run: cmake --build . --config ${{ matrix.config.build_type }} --target examples -j
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCPP_CHANNEL_BUILD_TESTS=ON -DCPP_CHANNEL_COVERAGE=ON
- name: Build
working-directory: ${{github.workspace}}/build
run: cmake --build . --config Debug --target channel_tests -j
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C Debug --verbose -L channel_tests -j
- name: Generate coverage
working-directory: ${{github.workspace}}/build
run: |
sudo apt-get install lcov -y
lcov --capture --directory . --output-file coverage.info --ignore-errors mismatch
lcov --remove coverage.info "*/usr/*" -o coverage.info
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{github.workspace}}/build/coverage.info
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: C++
run: clang-format --dry-run --Werror $(find . -name *.*pp)
- name: CMake
run: |
pip install cmake-format
cmake-format -i $(find -name CMakeLists.txt)
git diff --exit-code
clang-tidy:
name: Clang Tidy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install
run: sudo apt-get install -y clang-tidy
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
working-directory: ${{github.workspace}}/build
run: cmake ${{ github.workspace }} -DCMAKE_BUILD_TYPE=Debug -DCPP_CHANNEL_BUILD_TESTS=ON
- name: Run Clang Tidy
run: clang-tidy -p ${{github.workspace}}/build $(find include -type f) -- -std=c++11