-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (51 loc) · 2.33 KB
/
cpp-linter.yml
File metadata and controls
57 lines (51 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: C++ linter
on:
push:
branches: [ "main" ]
paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', 'meson.build', '**.cmake', '**.clang_format', '**.clang-format-ignore', '**.clang-tidy', '**.clangd', '.github/workflows/cpp-linter.yml']
pull_request:
branches: [ "main" ]
paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', 'meson.build', '**.cmake', '**.clang_format', '**.clang-format-ignore', '**.clang-tidy', '**.clangd', '.github/workflows/cpp-linter.yml']
jobs:
cpp-linter:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v5
- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
-DCMAKE_BUILD_TYPE=Debug
-S ${{ github.workspace }}
-DUFO_BUILD_TESTS=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- uses: cpp-linter/cpp-linter-action@v2
id: linter
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: 21
style: 'file' # Use .clang-format config file
tidy-checks: '' # Use .clang-tidy config file
ignore: 'external'
# only 'update' a single comment in a pull request thread.
lines-changed-only: true
tidy-review: true
format-review: true
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}
database: ${{ steps.strings.outputs.build-output-dir }}
- name: Fail fast?!
if: steps.linter.outputs.checks-failed > 0
run: exit 1