Add intentional clang-tidy warning #168
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
# NOTE: This workflow is in the test_cpp_cache repository with full comments | |
name: Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- 'feature/*' | |
- 'bugfix/*' | |
- 'release/*' | |
- 'hotfix/*' | |
pull_request: | |
branches: | |
- main | |
- develop | |
env: | |
BUILD_TYPE: Release | |
SCCACHE_GHA_ENABLED: "true" | |
jobs: | |
# build-and-test: | |
# name: ${{ matrix.config.os }} ${{ matrix.config.compiler }} | |
# runs-on: ${{ matrix.config.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# 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@v4 | |
# # Reference: https://github.com/hendrikmuhs/ccache-action | |
# - name: Cache (non-Windows) | |
# if: runner.os != 'Windows' | |
# uses: hendrikmuhs/[email protected] | |
# with: | |
# key: ${{ runner.os }}-${{ matrix.config.compiler }}-${{ env.BUILD_TYPE }} | |
# # Reference: https://github.com/Mozilla-Actions/sccache-action | |
# - name: Cache (Windows) | |
# if: runner.os == 'Windows' | |
# uses: mozilla-actions/[email protected] | |
# # Reference: https://github.com/aminya/setup-cpp | |
# - name: Install C++ Tools | |
# uses: aminya/setup-cpp@v1 | |
# with: | |
# vcvarsall: ${{ runner.os == 'Windows' && matrix.config.compiler == 'msvc' }} | |
# ninja: true | |
# # Reference: https://cmake.org/cmake/help/latest/manual/cmake.1.html | |
# - 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 | |
# run: cmake --build ./build --config ${{env.BUILD_TYPE}} | |
# # Reference: https://cmake.org/cmake/help/latest/manual/ctest.1.html | |
# - name: Test | |
# working-directory: ./build | |
# run: ctest -C ${{env.BUILD_TYPE}} | |
# # Taken from doctest github | |
# coverage: | |
# runs-on: ubuntu-24.04 | |
# steps: | |
# - uses: actions/checkout@v4 | |
# # - name: Cache | |
# # uses: actions/cache@v4 | |
# # with: | |
# # path: | | |
# # ~/vcpkg | |
# # ~/.cache/vcpkg/archives | |
# # key: ${{ runner.os }}-vcpkg-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | |
# # restore-keys: | | |
# # ${{ runner.os }}-vcpkg-${{ env.BUILD_TYPE }}- | |
# - name: Install C++ Tools | |
# run: sudo apt-get install -y ninja-build lcov | |
# # # Reference: https://github.com/aminya/setup-cpp | |
# # - name: Install vcpkg | |
# # uses: aminya/setup-cpp@v1 | |
# # with: | |
# # vcpkg: true | |
# # - name: Install vcpkg dependencies | |
# # run: vcpkg install fmt catch2 | |
# - name: Configure CMake | |
# run: cmake -B ./build -G "Ninja Multi-Config" -D CMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage" | |
# - name: Build | |
# run: cmake --build ./build --config Release | |
# - name: Test | |
# run: ctest --test-dir ./build --no-tests=error | |
# - name: LCOV | |
# run: | | |
# mkdir coverage | |
# lcov -c -d ./build/ -o coverage/lcov.info --include "*include/caff*" | |
# - name: Codecov | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: ./coverage/lcov.info | |
# fail_ci_if_error: true | |
# Taken from doctest github | |
clang-tidy: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/vcpkg | |
~/.cache/vcpkg/archives | |
key: ${{ runner.os }}-vcpkg-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt', './vcpkg.json') }} | |
restore-keys: | | |
${{ runner.os }}-vcpkg-${{ env.BUILD_TYPE }}- | |
- name: Install Ninja | |
run: sudo apt-get install -y ninja-build | |
# Reference: https://github.com/aminya/setup-cpp | |
- name: Install vcpkg | |
uses: aminya/setup-cpp@v1 | |
with: | |
vcpkg: true | |
- name: Install vcpkg dependencies | |
run: vcpkg install fmt catch2 | |
# -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake | |
# -warnings-as-errors=* | |
- name: Configure CMake | |
run: cmake -B build -S . -G "Ninja Multi-Config" -D CMAKE_CXX_COMPILER=/usr/lib/llvm-18/bin/clang++ -D CMAKE_EXPORT_COMPILE_COMMANDS=ON -D CMAKE_CXX_CLANG_TIDY="clang-tidy-18;-header-filter=include/caff/.*" -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake | |
- name: Build | |
run: cmake --build build --config Release |