aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml15
-rw-r--r--CMakeLists.txt12
2 files changed, 27 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 064d06a..710bd6c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -38,3 +38,18 @@ jobs:
run: (cd build && ctest -V)
if: ${{ matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-10.15' }}
+ check_format:
+ runs-on: ubuntu-20.04
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ submodules: true
+
+ - name: Configure CMake
+ shell: bash
+ run: cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE
+
+ - name: Check format
+ shell: bash
+ run: cmake --build build --target clang-format-check
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6c3309..1b18c9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -367,3 +367,15 @@ if(BUILD_TOOLS)
add_sanitizers(cubeb-test)
install(TARGETS cubeb-test DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR})
endif()
+
+add_custom_target(clang-format-check
+ find
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ -type f (-name "*.cpp" -o -name "*.c" -o -name "*.h")
+ -not -path "*/src/speex/*"
+ -print0
+ | xargs -0 clang-format -Werror -n
+ COMMENT "Check formatting with clang-format"
+ VERBATIM)
+