-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (52 loc) · 2.73 KB
/
Copy pathstyle.yml
File metadata and controls
56 lines (52 loc) · 2.73 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
name: Tap House Style
# Enforces the shared Tap House Rules: (1) a drift check against the canonical
# TapHouse configs, (2) a clang-format layout check, and (3) clang-tidy naming +
# mandatory-braces over the external's own translation units.
#
# All three run on Linux with the same clang-tidy-18 as the rest of the family.
# tap.python~ only *configures* (via CMake) with the bundled Python runtime,
# which installs on macOS/Windows only — but linting just needs headers, so the
# clang-tidy step compiles the TUs directly against min-api and the system
# Python headers instead of a compile database. (Running the lint on macOS
# instead means fighting the SDK's libc++ against a standalone clang-tidy.)
on: [push, pull_request]
jobs:
drift:
uses: tap/taphouse/.github/workflows/drift-check.yml@v4
with:
ref: v4
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get update -q && sudo apt-get install -y -q clang-format-18
- name: clang-format check (own sources)
run: clang-format-18 --dry-run --Werror $(git ls-files 'source/projects/*.cpp' 'source/projects/*.h')
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install tools
run: sudo apt-get update -q && sudo apt-get install -y -q clang-tidy-18 python3-dev
- name: clang-tidy (this object's own TUs; min-api, CPython, deps excluded)
run: |
d=source/projects/tap.python_tilde
msdk=source/min-api/max-sdk-base/c74support
pyinc=$(python3 -c "import sysconfig; print(sysconfig.get_path('include'))")
inc="-Isource/min-api/include -I$msdk -I$msdk/max-includes -I$msdk/msp-includes -I$msdk/jit-includes -I$pyinc -I$d"
# Scope diagnostics to this object's own headers: a path filter over
# source/projects would also match the bundled CPython headers, which
# are reached via …/tap.python_tilde/../../../support/… .
hf='.*/tap\.python_tilde/tap\.python_tilde.*'
fail=0
check() { # <file> <extra compile args…>
local f="$1"; shift
out=$(clang-tidy-18 -header-filter="$hf" --warnings-as-errors='readability-*' "$f" -- -std=c++17 $inc "$@" 2>/dev/null || true)
if echo "$out" | grep -qE "warning:|error:"; then echo "$out"; fail=1; fi
}
check "$d/tap.python_tilde.cpp" -DC74_MIN_API
check "$d/tap.python_tilde_test.cpp" -DC74_MIN_API -DMIN_TEST -Isource/min-api/test -DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS
[ "$fail" -eq 0 ] && echo "clang-tidy clean." || { echo "::error::clang-tidy found violations"; exit 1; }