Skip to content

Commit

Permalink
Introduce clang-tidy review
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurBandaryk committed Feb 2, 2022
1 parent 368b3f6 commit 462c3d4
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
UseColor: true

# Discuss if we wanna add some extra checks.
Checks: >
bugprone-*,
clang-analyzer-cplusplus*,
concurrency-*,
cppcoreguidelines-*,
google-*,
modernize-*,
performance-*,
readability-*,
HeaderFilterRegex: '^\.\/eventuals\/.*|^\.\/test\/.*'

WarningsAsErrors: ""
48 changes: 48 additions & 0 deletions .github/workflows/clang_tidy_review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Workflow for doing review based on clang-tidy.
name: Code review with clang-tidy

on:
push:
branches:
- "main"
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"

jobs:
clang_tidy_checks:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# For now we run clang-tidy checks for macOS and Ubuntu.
# Later we will run clang-tidy checks for Windows too.
os: ["macos-latest", "ubuntu-latest"]

steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Generate compile_commands.json
run: |
chmod +x dev-tools/clang-tidy-review/generate_compilation_database.sh
dev-tools/clang-tidy-review/generate_compilation_database.sh
- name: Install clang-tidy on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y clang-tidy-12
sudo ln -s $(which clang-tidy-12) /usr/bin/clang-tidy
- name: Create clang-tidy symlink on macOS
if: ${{ matrix.os == 'macos-latest' }}
run: |
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy"
clang-tidy --version
- name: Run clang-tidy checks
run: |
chmod +x dev-tools/clang-tidy-review/clang_tidy_review.sh
dev-tools/clang-tidy-review/clang_tidy_review.sh
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ bazel-bin
bazel-eventuals
bazel-out
bazel-testlogs
user.bazelrc
dev-tools/compilation-database/bazel-compilation-database.*
user.bazelrc
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "dev-tools"]
path = dev-tools
url = https://github.com/3rdparty/dev-tools.git
branch = ArthurBandaryk.generate-compilation-database
2 changes: 1 addition & 1 deletion dev-tools

0 comments on commit 462c3d4

Please sign in to comment.