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