FIxed run.sh and run.bat
Some checks failed
Run Integration Tests / test (push) Failing after 42s

This commit is contained in:
partisan 2025-06-01 09:54:09 +02:00
parent 8dbfaae1b6
commit 59e0ee33a5
2 changed files with 27 additions and 15 deletions

31
run.sh
View file

@ -5,6 +5,8 @@ SKIP_CONFIG=""
PORT=""
DOMAIN=""
CONFIG_FILE=""
BUILD_ONLY=0
PLATFORM="linux"
BUILD_OUTPUT="qgato"
# Parse arguments
@ -22,6 +24,14 @@ while [ $# -gt 0 ]; do
CONFIG_FILE=$2
shift 2
;;
--platform)
PLATFORM=$2
shift 2
;;
--build-only)
BUILD_ONLY=1
shift
;;
--skip-config-check)
SKIP_CONFIG="--skip-config-check"
shift
@ -36,15 +46,21 @@ done
# Get the directory of the script
SCRIPT_DIR=$(dirname "$0")
# List all Go files in the script directory (excluding test files)
GO_FILES=$(find "$SCRIPT_DIR" -name '*.go' ! -name '*_test.go' -print)
# Set GOOS and output filename
if [ "$PLATFORM" = "windows" ]; then
GOOS=windows
BUILD_OUTPUT="qgato.exe"
else
GOOS=linux
BUILD_OUTPUT="qgato"
fi
# Always delete and rebuild the binary
# Clean and build
echo "Cleaning previous build..."
rm -f "$SCRIPT_DIR/$BUILD_OUTPUT"
echo "Building application..."
go build -o "$SCRIPT_DIR/$BUILD_OUTPUT" $GO_FILES
echo "Building application for $PLATFORM..."
GOOS=$GOOS go build -ldflags="-s -w" -o "$SCRIPT_DIR/$BUILD_OUTPUT" .
if [ $? -eq 0 ]; then
echo "Build successful! Output: $SCRIPT_DIR/$BUILD_OUTPUT"
else
@ -52,6 +68,11 @@ else
exit 1
fi
# Skip execution if build-only
if [ "$BUILD_ONLY" -eq 1 ]; then
exit 0
fi
# Construct the run command
CMD="$SCRIPT_DIR/$BUILD_OUTPUT $SKIP_CONFIG"
[ -n "$PORT" ] && CMD="$CMD --port $PORT"