Merge pull request #2755 from zjeffer/master

Added clang-tidy GitHub action
This commit is contained in:
Alexis Rouillard 2023-12-20 23:25:33 +01:00 committed by GitHub
commit 2674982c7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 2 deletions

View File

@ -1,4 +1,4 @@
name: Linter name: clang-format
on: [push, pull_request] on: [push, pull_request]
@ -8,6 +8,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.16.2 - uses: DoozyX/clang-format-lint-action@v0.16.2
name: clang-format
with: with:
source: '.' source: '.'
extensions: 'hpp,h,cpp,c' extensions: 'hpp,h,cpp,c'

31
.github/workflows/clang-tidy.yml vendored Normal file
View File

@ -0,0 +1,31 @@
name: clang-tidy
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
container:
image: alexays/waybar:debian
steps:
- uses: actions/checkout@v3
- name: configure
run: |
meson -Dcpp_std=c++20 build # necessary to generate compile_commands.json
ninja -C build # necessary to find certain .h files (xdg, wayland, etc.)
- uses: zjeffer/cpp-linter-action@test/process-compilation-database
name: clang-tidy
id: clang-tidy-check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PIP_NO_CACHE_DIR: false
with:
style: "" # empty string => don't do clang-format checks here, we do them in clang-format.yml
files-changed-only: true # only check files that have changed
lines-changed-only: true # only check lines that have changed
tidy-checks: "" # empty string => use the .clang-tidy file
version: "17" # clang-tools version
database: "build" # path to the compile_commands.json file
- name: Check if clang-tidy failed on any files
if: steps.clang-tidy-check.outputs.checks-failed > 0
run: echo "Some files failed the linting checks!" && exit 1