Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci] Add clang-tidy support #29

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/post@v0.13.2
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/clang-tidy-review@v0.13.2
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/upload@v0.13.1
Loading