aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPaul Adenot <[email protected]>2023-05-02 13:54:01 +0200
committerPaul Adenot <[email protected]>2023-05-02 16:17:23 +0200
commit5267a44443dc80db05a80db0f9004f6c538c1b29 (patch)
treed8deaa46bd45b9763982c1f7e915c2baed5b33d9
parent3e1293090ab7eedf211e69c679f96bbba0e3937a (diff)
downloadcubeb-5267a44443dc80db05a80db0f9004f6c538c1b29.tar.gz
cubeb-5267a44443dc80db05a80db0f9004f6c538c1b29.zip
Allow specifying a particular clang-format binary (version), and pin the CI to version 15
-rw-r--r--.github/workflows/build.yml7
-rw-r--r--CMakeLists.txt6
2 files changed, 10 insertions, 3 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 202f7e1..f4cb552 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -74,15 +74,18 @@ jobs:
run: cmake --build build
check_format:
- runs-on: ubuntu-20.04
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: true
+ - name: Install Dependencies (Linux)
+ run: sudo apt-get update && sudo apt-get install clang-format-15
+
- name: Configure CMake
shell: bash
- run: cmake -S . -B build
+ run: cmake -S . -B build -DCLANG_FORMAT_BINARY=clang-format-15
- name: Check format
shell: bash
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0aa6841..279968d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -427,6 +427,10 @@ if(BUILD_TOOLS)
install(TARGETS cubeb-test)
endif()
+if(NOT CLANG_FORMAT_BINARY)
+set(CLANG_FORMAT_BINARY clang-format)
+endif()
+
add_custom_target(clang-format-check
find
${CMAKE_CURRENT_SOURCE_DIR}/src
@@ -434,7 +438,7 @@ add_custom_target(clang-format-check
-type f (-name "*.cpp" -o -name "*.c" -o -name "*.h")
-not -path "*/subprojects/speex/*"
-print0
- | xargs -0 clang-format -Werror -n
+ | xargs -0 ${CLANG_FORMAT_BINARY} -Werror -n
COMMENT "Check formatting with clang-format"
VERBATIM)