lint_c.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: 'Lint C/C++ with clang-format'
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. - "release*"
  7. tags:
  8. - '*'
  9. pull_request:
  10. env:
  11. TARGETS: f7
  12. FBT_TOOLCHAIN_PATH: /runner/_work
  13. SET_GH_OUTPUT: 1
  14. jobs:
  15. lint_c_cpp:
  16. runs-on: [self-hosted,FlipperZeroShell]
  17. steps:
  18. - name: 'Decontaminate previous build leftovers'
  19. run: |
  20. if [ -d .git ]; then
  21. git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
  22. fi
  23. - name: 'Checkout code'
  24. uses: actions/checkout@v3
  25. with:
  26. fetch-depth: 0
  27. ref: ${{ github.event.pull_request.head.sha }}
  28. - name: 'Check code formatting'
  29. id: syntax_check
  30. run: ./fbt lint
  31. - name: Report code formatting errors
  32. if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request
  33. uses: peter-evans/create-or-update-comment@v1
  34. with:
  35. issue-number: ${{ github.event.pull_request.number }}
  36. body: |
  37. Please fix following code formatting errors:
  38. ```
  39. ${{ steps.syntax_check.outputs.errors }}
  40. ```
  41. You might want to run `./fbt format` for an auto-fix.