summaryrefslogtreecommitdiffstats
path: root/.github/workflows
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2024-01-09 14:47:16 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-02-26 14:57:53 +0100
commit20c563de40923d3333301ca8ed1f3f213a67ea17 (patch)
tree9da6a86399de77c74aba91e3d48b408b0a8516c2 /.github/workflows
parentbb6b06c81343073f10cbbd2af515cf0dac1e6549 (diff)
downloadredot-engine-20c563de40923d3333301ca8ed1f3f213a67ea17.tar.gz
Replace hand-written pre-commit hooks with `pre-commit` Python tool
`pre-commit` can be installed with pip, and configured in the Godot repo with `pre-commit install`. It can then easily be run both locally with `pre-commit run`, and on CI, in a cross-platform way. This makes it much easier for contributors to set up pre-commit hooks, without having to manually copy files to their git folder. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/static_checks.yml19
1 files changed, 4 insertions, 15 deletions
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index cf8b0f4132..a9808fee95 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -23,7 +23,7 @@ jobs:
- name: Install Python dependencies and general setup
run: |
- pip3 install black==23.3.0 pytest==7.1.2 mypy==0.971
+ pip3 install pytest==7.1.2 mypy==0.971
git config diff.wsErrorHighlight all
- name: Get changed files
@@ -46,6 +46,9 @@ jobs:
run: |
bash ./misc/scripts/gitignore_check.sh
+ - name: Style checks via pre-commit
+ uses: pre-commit/action@v3.0.1
+
- name: File formatting checks (file_format.sh)
run: |
bash ./misc/scripts/file_format.sh changed.txt
@@ -54,14 +57,6 @@ jobs:
run: |
bash ./misc/scripts/header_guards.sh changed.txt
- - name: Python style checks via black (black_format.sh)
- run: |
- if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
- bash ./misc/scripts/black_format.sh
- else
- echo "Skipping Python formatting as no Python files were changed."
- fi
-
- name: Python scripts static analysis (mypy_check.sh)
run: |
if grep -qE '\.py$|SConstruct|SCsub' changed.txt || [ -z "$(cat changed.txt)" ]; then
@@ -92,12 +87,6 @@ jobs:
- name: Documentation checks
run: |
doc/tools/doc_status.py doc/classes modules/*/doc_classes platform/*/doc_classes
- doc/tools/make_rst.py --dry-run --color doc/classes modules platform
-
- - name: Style checks via clang-format (clang_format.sh)
- run: |
- clang-format --version
- bash ./misc/scripts/clang_format.sh changed.txt
- name: Style checks via dotnet format (dotnet_format.sh)
run: |