From 763aad4a78d3368faf518d5cd1aa70c3d3539a0b Mon Sep 17 00:00:00 2001 From: archi Date: Wed, 2 Feb 2022 13:26:37 +0300 Subject: [PATCH] Introduce clang-tidy review --- .github/workflows/clang_tidy_review.yml | 48 +++++++++++++++++++++++++ .gitmodules | 1 + dev-tools | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/clang_tidy_review.yml 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/.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