Add Clang-Tidy to CI #57
Workflow file for this run
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
name: Unit tests - Clang Linux | |
on: | |
pull_request: | |
branches: | |
- '*' | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Checkout the project | |
uses: actions/checkout@v3 | |
- name: Install Clang 19 | |
run: | | |
wget https://apt.llvm.org/llvm.sh | |
chmod +x llvm.sh | |
sudo ./llvm.sh 19 | |
sudo apt install -y clang-format-19 clang-tidy-19 | |
- name: CMake | |
run: | | |
mkdir build | |
cd ./build | |
CC=/usr/bin/clang-19 CXX=/usr/bin/clang++-19 cmake -G"Unix Makefiles" ./.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | |
- name: Make | |
run: | | |
cd ./build | |
make | |
- name: Clang-Format | |
run: | | |
find ./src ./tests ./include ./examples \ | |
-type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.tpp" \) \ | |
! -path "./src/external_library/*" \ | |
! -path "./tests/audiofile/*" \ | |
-exec clang-format-19 --dry-run --Werror --verbose \ | |
{} + | |
- name: Clang-Tidy | |
run: | | |
clang-tidy-19 -p ./build/ --exclude-header-filter=* --use-color --quiet \ | |
$(find ./src ./tests ./include ./examples \ | |
-type f \( -name "*.cpp" -o -name "*.hpp" -o -name "*.tpp" \) \ | |
! -path "./src/external_library/*" \ | |
! -path "./tests/audiofile/*") | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compiled-tests | |
path: build/tests/ | |
run-unit-tests: | |
name: Run unit tests | |
runs-on: ubuntu-24.04 | |
needs: build | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: compiled-tests | |
path: ./build/tests/ | |
- name: Run tests | |
run: | | |
chmod -R +x ./build/tests/ | |
./build/tests/unit_tests/UnitTests --gtest_also_run_disabled_tests |