Skip to content

Commit 5ed3c59

Browse files
committed
Add/refactor clang-tidy github workflow
1 parent c73e2c7 commit 5ed3c59

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.clang-tidy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Checks: >
99
-cppcoreguidelines-pro-type-vararg,
1010
-cppcoreguidelines-owning-memory
1111
12+
UseColor: true
1213
WarningsAsErrors: ''
1314
HeaderFilterRegex: '.*'
14-
AnalyzeTemporaryDtors: false
1515
FormatStyle: file
1616
CheckOptions:
1717
- key: modernize-use-nullptr.NullMacros

.github/workflows/clang-tidy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: clang-tidy
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.cpp'
7+
- '**.h'
8+
- '**.hpp'
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
lint:
15+
name: Clang-Tidy Analysis
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Install dependencies
23+
run: sudo apt update && sudo apt install -y clang-tidy cmake ninja-build g++ gcc
24+
25+
- name: Configure project
26+
run: cmake --preset gcc-RelWithDebInfo
27+
28+
- name: Run clang-tidy
29+
run: |
30+
find src include tests -name '*.cpp' \
31+
| xargs clang-tidy -p build/gcc-RelWithDebInfo

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![CI](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/ci.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/ci.yml)
44
[![clang-format](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-format.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-format.yml)
5+
[![clang-tidy](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-tidy.yml/badge.svg)](https://github.com/ramsafin/modern-cpp-project-template/actions/workflows/clang-tidy.yml)
6+
57
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
68

79
> A modern C++20+ starter project using CMake, GoogleTest, sanitizers, GitHub Actions, and developer tooling.

0 commit comments

Comments
 (0)