Skip to content

Commit 75c9e49

Browse files
Retain local scripts again and forward
1 parent 5b52936 commit 75c9e49

5 files changed

Lines changed: 103 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
- cmake/**
8282
- CMakeLists.txt
8383
- CMakePresets.json
84+
- scripts/clang-format.sh
85+
- scripts/clang-tidy.sh
8486
- cpp-tools
8587
- cpp-tools/**
8688
- .gitmodules
@@ -136,12 +138,13 @@ jobs:
136138
if: ${{ needs.changes.outputs.cpp_tools == 'true' || github.event_name == 'workflow_dispatch' }}
137139
# GitHub loads this workflow from the separate cpp-tools repository. Keep
138140
# this immutable ref aligned with the cpp-tools submodule gitlink.
139-
uses: livekit/cpp-tools/.github/workflows/cpp-tools.yml@12c945180b6a2b48149c79be79d9d7d727fc3c12
141+
uses: livekit/cpp-tools/.github/workflows/cpp-tools.yml@707762771f079e0932c8c6a123e943a4b2fefe32
140142
with:
141143
clang_format: true
142144
clang_tidy: true
143145
checkout_submodules: recursive
144-
clang_format_paths: src include benchmarks
146+
clang_format_runner: scripts/clang-format.sh
147+
clang_tidy_runner: scripts/clang-tidy.sh
145148
clang_tidy_dependencies_command: |
146149
sudo apt-get update
147150
sudo apt-get install -y \
@@ -156,11 +159,6 @@ jobs:
156159
echo "LIBCLANG_PATH=/usr/lib/llvm-${LLVM_VERSION}/lib" >> "$GITHUB_ENV"
157160
clang_tidy_configure_command: cmake --preset linux-release
158161
clang_tidy_generate_command: cmake --build build-release --target livekit_proto
159-
clang_tidy_build_dir: build-release
160-
clang_tidy_file_regex: '^(?!.*/(_deps|build-[^/]*|client-sdk-rust|cpp-example-collection|vcpkg_installed|docker|docs|data)/).*/src/(?!tests/).*\.(c|cpp|cc|cxx)$'
161-
clang_tidy_header_filter: '.*/(include/livekit|src)/.*\.(h|hpp)$'
162-
clang_tidy_exclude_header_filter: '(.*/src/tests/.*)|(.*/_deps/.*)|(.*/build-[^/]*/.*)'
163-
clang_tidy_require_generated_protobuf: build-release/generated
164162

165163
generate-docs:
166164
name: Generate Docs

docs/tools.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,34 +59,34 @@ Install the shared configuration symlinks from the repository root:
5959
./build.sh release
6060
```
6161

62-
2. Run the shared script with the same file set, regex filters, and
63-
`.clang-tidy` config as CI:
62+
2. Run the project wrapper. It supplies the same build directory and filters
63+
as CI, then delegates diagnostics and summaries to `cpp-tools`:
6464

6565
```bash
66-
./cpp-tools/clang-tidy.sh \
67-
--build-dir build-release \
68-
--file-regex '^(?!.*/(_deps|build-[^/]*|client-sdk-rust|cpp-example-collection|vcpkg_installed|docker|docs|data)/).*/src/(?!tests/).*\.(c|cpp|cc|cxx)$' \
69-
--header-filter '.*/(include/livekit|src)/.*\.(h|hpp)$' \
70-
--exclude-header-filter '(.*/src/tests/.*)|(.*/_deps/.*)|(.*/build-[^/]*/.*)' \
71-
--require-generated-protobuf build-release/generated
66+
./scripts/clang-tidy.sh
7267
```
7368

7469
Pass source files positionally to limit analysis, `-j N` to override the worker
75-
count, or `--fix` to apply fixes.
70+
count, `--fail-on-warning` for a strict local run, or `--fix` to apply fixes:
71+
72+
```bash
73+
./scripts/clang-tidy.sh src/room.cpp
74+
./scripts/clang-tidy.sh --fail-on-warning
75+
```
7676

7777
Output is captured to `clang-tidy.log` at the repo root, since the terminal
7878
buffer often can't hold all of it.
7979

8080
### Run `clang-format`
8181

8282
```bash
83-
./cpp-tools/clang-format.sh --path src --path include --path benchmarks
83+
./scripts/clang-format.sh
8484
```
8585

8686
```bash
87-
./cpp-tools/clang-format.sh --path src --path include --path benchmarks --fix
88-
./cpp-tools/clang-format.sh src/room.cpp include/livekit/room.h
89-
./cpp-tools/clang-format.sh --fix src/room.cpp
87+
./scripts/clang-format.sh --fix
88+
./scripts/clang-format.sh src/room.cpp include/livekit/room.h
89+
./scripts/clang-format.sh --fix src/room.cpp
9090
```
9191

9292
Output is captured to `clang-format.log` at the repo root.

scripts/clang-format.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2026 LiveKit
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
20+
shared_script="${repo_root}/cpp-tools/clang-format.sh"
21+
config="${repo_root}/.clang-format"
22+
expected_config="cpp-tools/.clang-format"
23+
24+
if [[ ! -x "${shared_script}" ]]; then
25+
echo "ERROR: cpp-tools/clang-format.sh is unavailable." >&2
26+
echo "Run: git submodule update --init cpp-tools" >&2
27+
exit 1
28+
fi
29+
30+
if [[ ! -L "${config}" ]] || [[ "$(readlink "${config}")" != "${expected_config}" ]]; then
31+
echo "ERROR: the project .clang-format link is not installed." >&2
32+
echo "Run: ./cpp-tools/install.sh clang-format" >&2
33+
exit 1
34+
fi
35+
36+
export CLANG_FORMAT_FIX_COMMAND="./scripts/clang-format.sh --fix"
37+
exec "${shared_script}" \
38+
--repo-root "${repo_root}" \
39+
--path src \
40+
--path include \
41+
--path benchmarks \
42+
"$@"

scripts/clang-tidy.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2026 LiveKit
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
set -euo pipefail
18+
19+
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
20+
shared_script="${repo_root}/cpp-tools/clang-tidy.sh"
21+
config="${repo_root}/.clang-tidy"
22+
expected_config="cpp-tools/.clang-tidy"
23+
24+
if [[ ! -x "${shared_script}" ]]; then
25+
echo "ERROR: cpp-tools/clang-tidy.sh is unavailable." >&2
26+
echo "Run: git submodule update --init cpp-tools" >&2
27+
exit 1
28+
fi
29+
30+
if [[ ! -L "${config}" ]] || [[ "$(readlink "${config}")" != "${expected_config}" ]]; then
31+
echo "ERROR: the project .clang-tidy link is not installed." >&2
32+
echo "Run: ./cpp-tools/install.sh clang-tidy" >&2
33+
exit 1
34+
fi
35+
36+
exec "${shared_script}" \
37+
--repo-root "${repo_root}" \
38+
--build-dir build-release \
39+
--file-regex '^(?!.*/(_deps|build-[^/]*|client-sdk-rust|cpp-example-collection|vcpkg_installed|docker|docs|data)/).*/src/(?!tests/).*\.(c|cpp|cc|cxx)$' \
40+
--header-filter '.*/(include/livekit|src)/.*\.(h|hpp)$' \
41+
--exclude-header-filter '(.*/src/tests/.*)|(.*/_deps/.*)|(.*/build-[^/]*/.*)' \
42+
"$@"

0 commit comments

Comments
 (0)