-
-
Notifications
You must be signed in to change notification settings - Fork 349
33 lines (28 loc) · 1.04 KB
/
format-lint.yml
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
name: Code Linting
on:
workflow_call:
workflow_dispatch:
jobs:
lint:
name: Format / Lint
# FIXME: ubuntu-latest has clang-format v18 which contains a bug: # https://bugreports.qt.io/browse/QTCREATORBUG-31858.
# Update this once ubuntu ships clang-format v19
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up cmake-format
run: pip install cmakelang
- name: Run clang-format
run: find src/ -iregex '.*\.\(cpp\|h\|mm\)$' -print0 | xargs -n 1 -0 clang-format -style=file --dry-run --Werror --color=true
- name: Run cmake-format
run: |
cmake-format CMakeLists.txt > CMakeLists-new.txt
if ! cmp -s CMakeLists.txt CMakeLists-new.txt
then
echo 'Please format CMakeLists.txt using cmake-format: https://github.com/cheshirekow/cmake_format'
echo 'For example: cmake-format CMakeLists.txt | sponge CMakeLists.txt'
exit 1
fi