-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (73 loc) · 3.98 KB
/
Copy pathstyle.yml
File metadata and controls
79 lines (73 loc) · 3.98 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
79
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 external's TUs directly against min-api and
# CPython 3.13's headers instead of a compile database. The core (core/) does
# configure on Linux, so its test TUs are linted through its compile database. (Running the lint on macOS
# instead means fighting the SDK's libc++ against a standalone clang-tidy.)
on: [push, pull_request]
# Least privilege: the jobs only read the repository. Third-party actions are pinned by
# commit SHA (the tag each SHA was cut from is noted beside it).
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
drift:
uses: tap/taphouse/.github/workflows/drift-check.yml@v5
with:
ref: v5
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- 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' 'core/*.cpp' 'core/*.h')
clang-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
submodules: recursive
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.13"
- name: Install tools
run: sudo apt-get update -q && sudo apt-get install -y -q clang-tidy-18
- name: Configure the core (compile database for its tests)
run: cmake -S core -B build-core -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DPython3_EXECUTABLE="$(which python)"
- name: clang-tidy (this object's and the core's own TUs; min-api, CPython, deps excluded)
run: |
d=source/projects/tap.python_tilde
msdk=source/min-api/max-sdk-base/c74support
pyinc=$(python -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 -Icore/include -I$d"
# Scope diagnostics to this object's and the core'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|core/(include|tests)/).*'
fail=0
check() { # <file> <clang-tidy args…>
# a finding, a compile error, or clang-tidy itself failing (non-zero exit with or
# without output — a crash or a broken invocation) all fail the gate
local f="$1"; shift
local out status=0
out=$(clang-tidy-18 -header-filter="$hf" --warnings-as-errors='readability-*' "$f" "$@" 2>&1) || status=$?
if [ "$status" -ne 0 ] || echo "$out" | grep -qE "warning:|error:"; then
echo "== $f (clang-tidy exit $status)"; echo "$out"; fail=1
fi
}
check "$d/tap.python_tilde.cpp" -- -std=c++20 $inc -DC74_MIN_API
check "$d/tap.python_tilde_test.cpp" -- -std=c++20 $inc -DC74_MIN_API -DMIN_TEST -Isource/min-api/test -DCATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS
for f in core/tests/*.cpp; do
check "$f" -p build-core
done
[ "$fail" -eq 0 ] && echo "clang-tidy clean." || { echo "::error::clang-tidy found violations"; exit 1; }