Files
Commonwealth-Online-Server/server/scripts/linux_compat_checks.sh
T

44 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
cd -- "${ROOT}"
echo "==> Rejecting Python source/runtime dependencies"
if find .. -type f -name '*.py' -print -quit | grep -q .; then
find .. -type f -name '*.py' -print
echo "ERROR: Python source files are not allowed in CO-SERVER." >&2
exit 1
fi
if find . -maxdepth 1 -type f -name 'requirements*.txt' -print -quit | grep -q .; then
find . -maxdepth 1 -type f -name 'requirements*.txt' -print
echo "ERROR: Python requirements files are not allowed." >&2
exit 1
fi
if grep -RInE --exclude-dir=.git --exclude='*.md' --exclude='PORT_TROUBLESHOOTING.txt' '(python3?|\.venv|pip install|consumer_server_cli\.py)' ..; then
echo "ERROR: Python runtime references remain in executable/configuration files." >&2
exit 1
fi
echo "==> Checking start.sh line endings"
if LC_ALL=C grep -n $'\r' start.sh >/dev/null 2>&1; then
echo "ERROR: start.sh contains CR/CRLF line endings" >&2
exit 1
fi
chmod +x start.sh fix-port.sh
test -x start.sh
bash -n start.sh
bash -n fix-port.sh
if command -v shellcheck >/dev/null 2>&1; then
shellcheck start.sh fix-port.sh
fi
command -v dotnet >/dev/null 2>&1 || { echo "ERROR: dotnet SDK is required" >&2; exit 1; }
dotnet --info
dotnet build CommonwealthOnline.Server.csproj -c Release --nologo
dotnet run --project tests/CommonwealthOnline.Server.Tests.csproj -c Release --no-restore
echo "All C# Linux compatibility checks passed."