diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 000000000..680320589 --- /dev/null +++ b/.clang-tidy @@ -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: "" diff --git a/.github/workflows/clang_tidy_review.yml b/.github/workflows/clang_tidy_review.yml new file mode 100644 index 000000000..5cdfdb5a5 --- /dev/null +++ b/.github/workflows/clang_tidy_review.yml @@ -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 diff --git a/.gitignore b/.gitignore index ffe022b37..982442906 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ bazel-bin bazel-eventuals bazel-out bazel-testlogs -user.bazelrc \ No newline at end of file +dev-tools/compilation-database/bazel-compilation-database.* +user.bazelrc diff --git a/.gitmodules b/.gitmodules index 4b7a6a7f4..219f3280a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "dev-tools"] path = dev-tools url = https://github.com/3rdparty/dev-tools.git + branch = ArthurBandaryk.generate-compilation-database diff --git a/dev-tools b/dev-tools index 09917cd32..886675f07 160000 --- a/dev-tools +++ b/dev-tools @@ -1 +1 @@ -Subproject commit 09917cd321a1a608ecc3266454d5ca4f569681d6 +Subproject commit 886675f079fe83b224b9a06f2bae86bb69833ac0