Skip to content

Add CMake clang-tidy integration, enable in CI, and fix all clang-tidy errors #107

Add CMake clang-tidy integration, enable in CI, and fix all clang-tidy errors

Add CMake clang-tidy integration, enable in CI, and fix all clang-tidy errors #107

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- main
- 'releases/**'
tags:
- 'merklecpp-*'
- 'v*'
pull_request:
permissions:
contents: read
jobs:
build-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
build_type: [Debug, Release]
compiler: [g++, clang++]
include:
- os: windows-latest
build_type: Debug
compiler: msvc
- os: windows-latest
build_type: Release
compiler: msvc
steps:
- name: Install packages
run: sudo apt install doctest-dev clang clang-tidy
if: matrix.os == 'ubuntu-latest'
- uses: actions/checkout@v4
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build/${{ matrix.build_type }}
- name: Configure CMake
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
shell: bash
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cmake $GITHUB_WORKSPACE -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON -DOPENSSL=ON -DCLANG_TIDY=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
else
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DTESTS=ON
fi
- name: Build
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
shell: bash
run: cmake --build . --config ${{ matrix.build_type }}
- name: Clang-Tidy Header
if: matrix.os == 'ubuntu-latest'
shell: bash
run: clang-tidy merklecpp.h -p build/${{ matrix.build_type }} --warnings-as-errors='*'
- name: Test
working-directory: ${{github.workspace}}/build/${{ matrix.build_type }}
shell: bash
run: ctest -VV -C ${{ matrix.build_type }}
env:
ASAN_OPTIONS: use_sigaltstack=false # To avoid SetAlternateSignalStack with clang-11