static_checks.yml 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. name: 📊 Static Checks
  2. on:
  3. workflow_call:
  4. jobs:
  5. static-checks:
  6. name: Code style, file formatting, and docs
  7. runs-on: ubuntu-24.04
  8. timeout-minutes: 30
  9. steps:
  10. - name: Checkout
  11. uses: actions/checkout@v4
  12. with:
  13. fetch-depth: 2
  14. # This needs to happen before Python and npm execution; it must happen before any extra files are written.
  15. - name: .gitignore checks (gitignore_check.sh)
  16. run: |
  17. bash ./misc/scripts/gitignore_check.sh
  18. - name: Get changed files
  19. env:
  20. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  21. run: |
  22. if [ "${{ github.event_name }}" == "pull_request" ]; then
  23. files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
  24. elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
  25. files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
  26. fi
  27. files=$(echo "$files" | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
  28. echo "CHANGED_FILES=$files" >> $GITHUB_ENV
  29. - name: Style checks via pre-commit
  30. uses: pre-commit/[email protected]
  31. with:
  32. extra_args: --files ${{ env.CHANGED_FILES }}
  33. - name: Class reference schema checks
  34. run: |
  35. sudo apt update
  36. sudo apt install -y libxml2-utils
  37. xmllint --quiet --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml
  38. - name: Run C compiler on `gdextension_interface.h`
  39. run: |
  40. gcc -c core/extension/gdextension_interface.h