static_checks.yml 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. name: 📊 Static Checks
  2. on:
  3. workflow_call:
  4. concurrency:
  5. group: ci-${{ github.actor }}-${{ github.head_ref || github.run_number }}-${{ github.ref }}-static
  6. cancel-in-progress: true
  7. jobs:
  8. static-checks:
  9. name: Code style, file formatting, and docs
  10. runs-on: ubuntu-24.04
  11. steps:
  12. - name: Checkout
  13. uses: actions/checkout@v4
  14. with:
  15. fetch-depth: 2
  16. - name: Install APT dependencies
  17. uses: awalsh128/cache-apt-pkgs-action@latest
  18. with:
  19. packages: libxml2-utils
  20. - name: Install Python dependencies and general setup
  21. run: |
  22. pip3 install pytest==7.1.2
  23. git config diff.wsErrorHighlight all
  24. - name: Get changed files
  25. env:
  26. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  27. run: |
  28. if [ "${{ github.event_name }}" == "pull_request" ]; then
  29. files=$(git diff-tree --no-commit-id --name-only -r HEAD^1..HEAD 2> /dev/null || true)
  30. elif [ "${{ github.event_name }}" == "push" -a "${{ github.event.forced }}" == "false" -a "${{ github.event.created }}" == "false" ]; then
  31. files=$(git diff-tree --no-commit-id --name-only -r ${{ github.event.before }}..${{ github.event.after }} 2> /dev/null || true)
  32. fi
  33. echo "$files" >> changed.txt
  34. cat changed.txt
  35. files=$(echo "$files" | grep -v 'thirdparty' | xargs -I {} sh -c 'echo "\"./{}\""' | tr '\n' ' ')
  36. echo "CHANGED_FILES=$files" >> $GITHUB_ENV
  37. # This needs to happen before Python and npm execution; it must happen before any extra files are written.
  38. - name: .gitignore checks (gitignore_check.sh)
  39. run: |
  40. bash ./misc/scripts/gitignore_check.sh
  41. - name: Style checks via pre-commit
  42. uses: pre-commit/action@v3.0.1
  43. with:
  44. extra_args: --files ${{ env.CHANGED_FILES }}
  45. - name: Python builders checks via pytest
  46. run: |
  47. pytest ./tests/python_build
  48. - name: Class reference schema checks
  49. run: |
  50. xmllint --noout --schema doc/class.xsd doc/classes/*.xml modules/*/doc_classes/*.xml platform/*/doc_classes/*.xml
  51. - name: Run C compiler on `gdextension_interface.h`
  52. run: |
  53. gcc -c core/extension/gdextension_interface.h