-
Notifications
You must be signed in to change notification settings - Fork 11
/
init-and-run-tests.sh
executable file
·59 lines (45 loc) · 1.52 KB
/
init-and-run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
set -e
GODOT_VERSION=$1
GUT_PARAMS=$2
PROJECT_PATH=$3
GODOT_BIN=/usr/local/bin/godot
# Download Godot
GODOT_PARAMS=
is_version_4=$( [[ $GODOT_VERSION == 4* ]] && echo "true" || echo "false" )
if [[ $is_version_4 == "true" ]]; then
echo "Downloading Godot4"
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip
# Unzip it
unzip Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip
mv Godot_v${GODOT_VERSION}-stable_linux.x86_64 $GODOT_BIN
GODOT_PARAMS="--headless"
else
echo "Downloading Godot3"
# Use official release download
wget https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip
# Unzip it
unzip Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip
mv Godot_v${GODOT_VERSION}-stable_linux_headless.64 $GODOT_BIN
fi
# Run the tests
if [[ -n $PROJECT_PATH ]]; then
cd $PROJECT_PATH
fi
echo Running GUT tests using params:
echo " -> $GUT_PARAMS"
TEMP_FILE=/tmp/gut.log
$GODOT_BIN -d -s $GODOT_PARAMS --path $PWD addons/gut/gut_cmdln.gd -gexit $GUT_PARAMS 2>&1 | tee $TEMP_FILE
# Godot always exists with error 0, but we want this action to fail in case of errors
if grep -q "No tests ran" "$TEMP_FILE" || grep -qE "Asserts\s+none" "$TEMP_FILE";
then
echo "No test ran. Please check your 'gut_params'"
exit 1
fi
if ! grep -q "All tests passed" "$TEMP_FILE"
then
echo "One or more test have failed"
exit 1
fi
echo "ALL GOOD :) :) :)"
exit 0