static_checks.yml 2.1 KB

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