Skip to content

Commit 0899b5d

Browse files
authored
feat: add clang-tidy to CI (#95)
Depends on #197. This PR adds clang-tidy to per-commit tests on branch `main` to detect potential breaks.
1 parent d5d2d12 commit 0899b5d

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. 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,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
name: mainline-only
19+
20+
on:
21+
workflow_dispatch:
22+
push:
23+
branches:
24+
- main
25+
26+
jobs:
27+
prepare:
28+
name: Prepare
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v5
32+
with:
33+
fetch-depth: 0
34+
fetch-tags: true
35+
- name: Detect skip ci and docs changes
36+
id: detect
37+
uses: ./.github/actions/detect-skip-ci
38+
with:
39+
github_event_name: ${{ github.event_name }}
40+
pr_base_ref: ${{ github.event.pull_request.base.ref || '' }}
41+
pr_head_sha: ${{ github.event.pull_request.head.sha || '' }}
42+
43+
clang-tidy:
44+
needs: [prepare]
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v5
48+
with:
49+
submodules: recursive
50+
fetch-depth: 0
51+
fetch-tags: true
52+
- name: Set up uv
53+
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
54+
- uses: ./.github/actions/detect-env-vars
55+
id: env_vars
56+
- name: Run clang-tidy
57+
run: |
58+
uv run --no-project --with "clang-tidy==21.1.1" \
59+
python tests/lint/clang_tidy_precommit.py \
60+
--build-dir=build-pre-commit \
61+
--jobs=${{ steps.env_vars.outputs.cpu_count }} \
62+
./src/ ./include ./tests

0 commit comments

Comments
 (0)