mirror of
https://github.com/build-cpp/cmkr
synced 2026-06-08 13:22:55 +00:00
42 lines
1.5 KiB
YAML
42 lines
1.5 KiB
YAML
name: lint
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
clang-format:
|
|
# Skip building pull requests from the same repository
|
|
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: clang-format
|
|
id: clang-format
|
|
uses: DoozyX/clang-format-lint-action@c71d0bf4e21876ebec3e5647491186f8797fde31 # v0.18.2
|
|
with:
|
|
exclude: './third_party'
|
|
extensions: 'c,h,cpp,hpp'
|
|
clangFormatVersion: 15
|
|
style: file
|
|
|
|
- name: clang-format instructions
|
|
if: ${{ failure() && steps.clang-format.outcome == 'failure' }}
|
|
run: |
|
|
# Instructions for fixing the formatting errors
|
|
echo -e "\n\033[0;31mTo fix the formatting, run:\nclang-format -style=file -i \$(git ls-files \"*.c\" \"*.h\" \"*.cpp\" \"*.hpp\")\033[0m\n"
|
|
exit 1
|
|
|
|
editorconfig:
|
|
# Skip building pull requests from the same repository
|
|
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Run editorconfig-checker
|
|
uses: editorconfig-checker/action-editorconfig-checker@27dd658c2b1282c7f1f4dc242cdf0f6d8af728ab # master 2025-05-30
|