Tweak CI to more closely match the main repo

This commit is contained in:
Aaron Franke
2020-07-24 21:56:43 -04:00
parent b7b3a75389
commit 2c138bd75f
5 changed files with 24 additions and 8 deletions

View File

@@ -1,15 +1,19 @@
name: Continuous integration name: Static Checks
on: [push, pull_request] on: [push, pull_request]
jobs: jobs:
build: format:
name: File formatting (file_format.sh)
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Lint demo projects - name: Install dependencies
run: | run: |
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -qq dos2unix recode sudo apt-get install -qq dos2unix recode
bash ./format.sh
- name: File formatting checks (file_format.sh)
run: |
bash ./file_format.sh

View File

@@ -108,7 +108,7 @@ func check_if_mouse_is_inside_canvas():
if mouse_click_start_pos.x > TL_node.global_position.x: if mouse_click_start_pos.x > TL_node.global_position.x:
if mouse_click_start_pos.y > TL_node.global_position.y: if mouse_click_start_pos.y > TL_node.global_position.y:
# Make sure the current mouse position is inside the canvas. # Make sure the current mouse position is inside the canvas.
if is_mouse_in_drawing_area == true: if is_mouse_in_drawing_area:
return true return true
return false return false

View File

@@ -1,12 +1,14 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script ensures proper POSIX text file formatting and a few other things.
set -uo pipefail set -uo pipefail
IFS=$'\n\t' IFS=$'\n\t'
# Loops through all text files tracked by Git. # Loops through all text files tracked by Git.
git grep -zIl '' | git grep -zIl '' |
while IFS= read -rd '' f; do while IFS= read -rd '' f; do
# Exclude csproj and hdr files. # Exclude some types of files.
if [[ "$f" == *"csproj" ]]; then if [[ "$f" == *"csproj" ]]; then
continue continue
elif [[ "$f" == *"hdr" ]]; then elif [[ "$f" == *"hdr" ]]; then
@@ -22,6 +24,18 @@ while IFS= read -rd '' f; do
tail -c1 < "$f" | read -r _ || echo >> "$f"; tail -c1 < "$f" | read -r _ || echo >> "$f";
# Remove trailing space characters. # Remove trailing space characters.
sed -z -i 's/\x20\x0A/\x0A/g' "$f" sed -z -i 's/\x20\x0A/\x0A/g' "$f"
# Remove the character sequence "== true" if it has a leading space.
sed -z -i 's/\x20== true//g' "$f"
# We don't want to change lines around braces in godot/tscn files.
if [[ "$f" == *"godot" ]]; then
continue
elif [[ "$f" == *"tscn" ]]; then
continue
fi
# Disallow empty lines after the opening brace.
sed -z -i 's/\x7B\x0A\x0A/\x7B\x0A/g' "$f"
# Disallow some empty lines before the closing brace.
sed -z -i 's/\x0A\x0A\x7D/\x0A\x7D/g' "$f"
done done
git diff > patch.patch git diff > patch.patch

View File

@@ -177,5 +177,4 @@ public class Node25D : Node2D, IComparable<Node25D>
} }
return 0; return 0;
} }
} }

View File

@@ -50,5 +50,4 @@ public class ShadowMath25D : KinematicBody
GlobalTransform = Transform; GlobalTransform = Transform;
} }
} }
} }