-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (49 loc) · 1.82 KB
/
Copy path_lint.yml
File metadata and controls
58 lines (49 loc) · 1.82 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
# Reusable: lint (clang-format + cargo clippy + cargo fmt)
name: Lint
on:
workflow_call: {}
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@v7 # v4.2.2
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y cmake ninja-build
# Install clang-format via pip — the PyPI wheel provides an
# exact version match (21.1.8) with the local dev environment
# (Homebrew llvm@21, which is what `which clang-format` resolves
# to on PATH). Ubuntu 24.04's default clang-format (v18) and the
# LLVM apt repo's clang-format-21 produce different formatting,
# causing spurious CI failures.
pip install clang-format==21.1.8
clang-format --version
- name: Setup Rust
uses: dtolnay/rust-toolchain@1.95.0 # pinned to match local dev
with:
components: clippy, rustfmt
- name: Cache Cargo registry
uses: actions/cache@v6 # v4.2.3
with:
path: |
~/.cargo/registry
~/.cargo/git
# Cargo.lock is committed — use it as the precise cache key
key: lint-cargo-registry-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
restore-keys: lint-cargo-registry-
- name: Lint Rust (clippy)
run: cargo clippy --all-targets -- -D warnings
- name: Check formatting (Rust)
run: cargo fmt --check
- name: Lint C++ (clang-format)
run: |
set -e
FILES=$(find engine/src engine/include -name '*.cpp' -o -name '*.h' 2>/dev/null)
if [ -n "$FILES" ]; then
echo "$FILES" | xargs clang-format --dry-run --Werror
echo " ✓ clang-format passed"
fi