static_checks.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. - name: Install APT dependencies
  15. run: |
  16. sudo apt update
  17. sudo apt install -y libxml2-utils
  18. - name: Install Python dependencies and general setup
  19. run: |
  20. pip3 install pytest==7.1.2
  21. git config diff.wsErrorHighlight all
  22. - name: Get changed files
  23. env:
  24. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  25. run: |
  26. if [ "${{ github.event_name }}" == "pull_request" ]; then
  27. files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
  28. elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
  29. files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
  30. fi
  31. echo "$files" >> changed.txt
  32. cat changed.txt
  33. files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
  34. echo "CHANGED_FILES=$files" >> $GITHUB_ENV
  35. # This needs to happen before Python and npm execution; it must happen before any extra files are written.
  36. - name: .gitignore checks (gitignore_check.sh)
  37. run: |
  38. bash ./misc/scripts/gitignore_check.sh
  39. - name: Style checks via pre-commit
  40. uses: pre-commit/[email protected]
  41. with:
  42. extra_args: --files ${{ env.CHANGED_FILES }}
  43. - name: Python builders checks via pytest
  44. run: |
  45. pytest ./tests/python_build
  46. - name: Class reference schema checks
  47. run: |
  48. xmllint --quiet --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml
  49. - name: Run C compiler on `gdextension_interface.h`
  50. run: |
  51. gcc -c core/extension/gdextension_interface.h