-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (69 loc) · 2.21 KB
/
Copy pathci-lint.yml
File metadata and controls
78 lines (69 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: CI Lint
on:
workflow_call:
jobs:
lint-cpp:
name: C++ Lint (clang-format + clang-tidy)
runs-on: ubuntu-22.04
env:
CARGO_TERM_COLOR: always
steps:
- name: Checkout (with siderust submodule)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Install system dependencies
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake \
ninja-build \
curl \
clang-tidy
- name: Install official qtty-cpp and tempoch-cpp packages
shell: bash
run: scripts/install-official-cpp-deps.sh
- name: Install clang-format 18
shell: bash
run: |
set -euo pipefail
wget -qO /tmp/llvm.sh https://apt.llvm.org/llvm.sh
sudo bash /tmp/llvm.sh 18
sudo apt-get install -y --no-install-recommends clang-format-18
sudo ln -sf /usr/bin/clang-format-18 /usr/local/bin/clang-format
clang-format --version
- name: Set up Rust (stable)
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Configure (CMake, compile commands)
shell: bash
run: |
set -euo pipefail
cmake -S . -B build -G Ninja -DSIDERUST_BUILD_DOCS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: clang-format check
shell: bash
run: |
set -euo pipefail
mapfile -t files < <(git ls-files '*.hpp' '*.cpp')
if [ ${#files[@]} -eq 0 ]; then
echo "No C++ files found."
exit 0
fi
clang-format --dry-run --Werror "${files[@]}"
- name: clang-tidy check
shell: bash
run: |
set -euo pipefail
mapfile -t cpp_files < <(git ls-files '*.cpp')
if [ ${#cpp_files[@]} -eq 0 ]; then
echo "No C++ source files found."
exit 0
fi
for file in "${cpp_files[@]}"; do
echo "Running clang-tidy on ${file}"
clang-tidy -p build --warnings-as-errors='*' "${file}"
done