Skip to content

Commit

Permalink
[ci] Add clang-tidy support
Browse files Browse the repository at this point in the history
Fixes #26.
  • Loading branch information
vgvassilev committed Jan 18, 2024
1 parent d7e4f32 commit 213eef1
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/clang-tidy-review-post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Post clang-tidy review comments

on:
workflow_run:
workflows: ["clang-tidy-review"]
types:
- completed

permissions:
checks: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Post review comments
id: post-review
uses: ZedThree/clang-tidy-review/[email protected]
with:
max_comments: 10

# If there are any comments, fail the check
- if: steps.post-review.outputs.total_comments > 0
run: exit 1
45 changes: 45 additions & 0 deletions .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: clang-tidy-review

on:
pull_request:
paths:
- '**.h'
- '**.hpp'
- '**.cpp'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
review:
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v3

- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "12.0.0"

- name: Run clang-tidy
uses: ZedThree/[email protected]
id: review
with:
build_dir: build
apt_packages: libxml2,libxml2-dev,libtinfo-dev,zlib1g-dev,libzstd-dev
exclude: "test/*,unittests/*,benchmark/*,demos/*"
split_workflow: true
cmake_command: >
pip install cmake lit &&
cmake --version &&
git config --global --add safe.directory /github/workspace &&
cmake . -B build -DLLVM_DIR="$GITHUB_WORKSPACE/llvm"
-DClang_DIR="$GITHUB_WORKSPACE/llvm"
-DCMAKE_BUILD_TYPE="Release"
-DLLVM_EXTERNAL_LIT="`which lit`"
-DCMAKE_EXPORT_COMPILE_COMMANDS=On
- name: Upload artifacts
uses: ZedThree/clang-tidy-review/[email protected]

0 comments on commit 213eef1

Please sign in to comment.