lint_c.yml 1.6 KB

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