check_style.yml 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. name: Verify code formatting
  2. on:
  3. push:
  4. pull_request:
  5. jobs:
  6. verify-formatting:
  7. if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
  8. runs-on: ubuntu-latest
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v2
  12. with:
  13. persist-credentials: false
  14. fetch-depth: 0
  15. - name: Install astyle
  16. run: |
  17. sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse"
  18. sudo apt-get update -y -qq
  19. sudo apt-get install astyle
  20. - name: Format code
  21. run: python code-format.py
  22. working-directory: scripts
  23. - name: Check that repository is clean
  24. shell: bash
  25. run: |
  26. set -o pipefail
  27. if ! (git diff --exit-code --color=always | tee /tmp/lvgl_diff.patch); then
  28. echo "Please apply the preceding diff to your code or run scripts/code-format.py"
  29. exit 1
  30. fi