lint_c.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. jobs:
  13. lint_c_cpp:
  14. runs-on: [self-hosted,FlipperZero]
  15. steps:
  16. - name: 'Cleanup workspace'
  17. uses: AutoModality/action-clean@v1
  18. - name: 'Decontaminate previous build leftovers'
  19. run: |
  20. if [ -d .git ]
  21. then
  22. git submodule status \
  23. || git checkout `git rev-list --max-parents=0 HEAD | tail -n 1`
  24. fi
  25. - name: 'Checkout code'
  26. uses: actions/checkout@v2
  27. with:
  28. fetch-depth: 0
  29. submodules: true
  30. - name: 'Docker cache'
  31. uses: satackey/action-docker-layer-caching@v0.0.11
  32. continue-on-error: true
  33. with:
  34. key: docker-cache-${{ hashFiles('docker/**') }}-{hash}
  35. restore-keys: docker-cache-${{ hashFiles('docker/**') }}-
  36. - name: 'Build docker image'
  37. uses: ./.github/actions/docker
  38. - name: 'Check code formatting'
  39. id: syntax_check
  40. uses: ./.github/actions/docker
  41. with:
  42. run: SET_GH_OUTPUT=1 ./fbt lint
  43. - name: Report code formatting errors
  44. if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request
  45. uses: peter-evans/create-or-update-comment@v1
  46. with:
  47. issue-number: ${{ github.event.pull_request.number }}
  48. body: |
  49. Please fix following code formatting errors:
  50. ```
  51. ${{ steps.syntax_check.outputs.errors }}
  52. ```
  53. You might want to run `docker compose exec dev make format` for an auto-fix.