-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
82 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.6.0 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format | ||
- repo: https://github.com/Scony/godot-gdscript-toolkit | ||
rev: 4.2.2 | ||
hooks: | ||
- id: gdlint | ||
additional_dependencies: [setuptools] | ||
- id: gdformat | ||
additional_dependencies: [setuptools] | ||
- repo: local | ||
hooks: | ||
- id: ruff-scons | ||
name: ruff-scons | ||
description: This hook runs ruff to check and format Scons python code. | ||
entry: bash -c 'ruff check SConstruct --fix && ruff format SConstruct' # I couldn't find any other way to get ruff to check the SConstruct file :( | ||
language: system | ||
pass_filenames: false | ||
- id: clang-format-run | ||
name: clang-format | ||
description: This hook runs clang-format to format code in the 'src' directory. | ||
entry: bash -c 'find ./src/ \( -iname "*.hpp" -o -iname "*.cpp" \) -exec clang-format -i {} + && exit 0' | ||
language: system | ||
pass_filenames: false | ||
- id: gdextension-tests | ||
name: gdextension-tests | ||
description: This hook runs all of your project's SFT test code using a disgusting bash one liner. | ||
entry: bash -c 'touch output.txt && /usr/bin/godot -e --headless --quit &> output.txt && output_file_path="output.txt"; grep "Failed" "$output_file_path" > failed_tests.txt; rm $output_file_path; if [[ -s failed_tests.txt ]]; then echo "Failed tests:"; cat failed_tests.txt; rm failed_tests.txt; exit 1; else rm failed_tests.txt; exit 0; fi;' | ||
language: system | ||
pass_filenames: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
output_file_path="output.txt" | ||
failed_tests=() | ||
content=$(cat "$output_file_path") | ||
for line in $content; do | ||
if [[ $line == *"Failed"* ]]; then | ||
failed_tests+=("$line") | ||
fi | ||
done | ||
|
||
rm "$output_file_path" | ||
|
||
if (( ${#failed_tests[@]} > 0 )); then | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |