You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
885 B
32 lines
885 B
name: Code Linting
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Format / Lint
|
|
runs-on: ubuntu-latest
|
|
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
|