Some checks failed
Continuous Integration / Code Formatting (pull_request) Successful in 27s
Continuous Integration / Code Quality Check (pull_request) Successful in 29s
Continuous Integration / Test Execution (pull_request) Failing after 33s
Continuous Integration / CI Summary (pull_request) Failing after 5s
241 lines
7.1 KiB
Bash
241 lines
7.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
# =============================================================================
|
|
# Skelly Development Tools Runner
|
|
# =============================================================================
|
|
#
|
|
# This script runs development tools for the Skelly Godot project.
|
|
# By default, it runs all checks: linting, formatting, and testing.
|
|
#
|
|
# Usage:
|
|
# ./run_dev.sh - Run all checks (lint + format + test)
|
|
# ./run_dev.sh --lint - Run only linting
|
|
# ./run_dev.sh --format - Run only formatting
|
|
# ./run_dev.sh --test - Run only tests
|
|
# ./run_dev.sh --help - Show this help message
|
|
# ./run_dev.sh --steps lint test - Run specific steps in order
|
|
#
|
|
# =============================================================================
|
|
|
|
# Initialize variables
|
|
ARG_LINT_ONLY=""
|
|
ARG_FORMAT_ONLY=""
|
|
ARG_TEST_ONLY=""
|
|
ARG_HELP=""
|
|
ARG_STEPS=""
|
|
CUSTOM_STEPS=""
|
|
|
|
# Parse command line arguments
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
--lint)
|
|
ARG_LINT_ONLY=1
|
|
shift
|
|
;;
|
|
--format)
|
|
ARG_FORMAT_ONLY=1
|
|
shift
|
|
;;
|
|
--test)
|
|
ARG_TEST_ONLY=1
|
|
shift
|
|
;;
|
|
--help)
|
|
ARG_HELP=1
|
|
shift
|
|
;;
|
|
--steps)
|
|
ARG_STEPS=1
|
|
shift
|
|
# Collect remaining arguments as custom steps
|
|
while [[ $# -gt 0 ]]; do
|
|
if [[ -z "$CUSTOM_STEPS" ]]; then
|
|
CUSTOM_STEPS="$1"
|
|
else
|
|
CUSTOM_STEPS="$CUSTOM_STEPS $1"
|
|
fi
|
|
shift
|
|
done
|
|
;;
|
|
*)
|
|
echo "❌ Unknown argument: $1"
|
|
echo "Use --help for usage information"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Show help if requested
|
|
if [[ -n "$ARG_HELP" ]]; then
|
|
echo
|
|
echo "🔧 Skelly Development Tools Runner"
|
|
echo
|
|
echo "Usage:"
|
|
echo " ./run_dev.sh - Run all checks (lint + format + test)"
|
|
echo " ./run_dev.sh --lint - Run only linting"
|
|
echo " ./run_dev.sh --format - Run only formatting"
|
|
echo " ./run_dev.sh --test - Run only tests"
|
|
echo " ./run_dev.sh --help - Show this help message"
|
|
echo " ./run_dev.sh --steps lint test - Run specific steps in order"
|
|
echo
|
|
echo "Available steps for --steps:"
|
|
echo " lint - Run GDScript linting (gdlint)"
|
|
echo " format - Run GDScript formatting (gdformat)"
|
|
echo " test - Run Godot tests"
|
|
echo
|
|
echo "Examples:"
|
|
echo " ./run_dev.sh (runs lint, format, test)"
|
|
echo " ./run_dev.sh --lint (runs only linting)"
|
|
echo " ./run_dev.sh --steps format lint (runs format then lint)"
|
|
echo
|
|
exit 0
|
|
fi
|
|
|
|
echo "================================"
|
|
echo "🚀 Development Tools Runner"
|
|
echo "================================"
|
|
echo
|
|
|
|
# Check if Python is available
|
|
if ! command -v python3 &> /dev/null && ! command -v python &> /dev/null; then
|
|
echo "❌ ERROR: Python is not installed or not in PATH"
|
|
echo
|
|
echo "Installation instructions:"
|
|
echo "1. Ubuntu/Debian: sudo apt update && sudo apt install python3 python3-pip"
|
|
echo "2. macOS: brew install python"
|
|
echo "3. Or download from: https://python.org/downloads"
|
|
echo "4. Restart your terminal"
|
|
echo "5. Run this script again"
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
# Use python3 if available, otherwise python
|
|
PYTHON_CMD="python3"
|
|
if ! command -v python3 &> /dev/null; then
|
|
PYTHON_CMD="python"
|
|
fi
|
|
|
|
# Check if pip is available
|
|
if ! command -v pip3 &> /dev/null && ! command -v pip &> /dev/null; then
|
|
echo "❌ ERROR: pip is not installed or not in PATH"
|
|
echo "Please ensure Python was installed correctly with pip"
|
|
exit 1
|
|
fi
|
|
|
|
# Use pip3 if available, otherwise pip
|
|
PIP_CMD="pip3"
|
|
if ! command -v pip3 &> /dev/null; then
|
|
PIP_CMD="pip"
|
|
fi
|
|
|
|
# Check if Godot is available (only if test step will be run)
|
|
NEED_GODOT=""
|
|
if [[ -n "$ARG_TEST_ONLY" ]]; then
|
|
NEED_GODOT=1
|
|
fi
|
|
if [[ -n "$ARG_STEPS" ]] && [[ "$CUSTOM_STEPS" == *"test"* ]]; then
|
|
NEED_GODOT=1
|
|
fi
|
|
if [[ -z "$ARG_LINT_ONLY" && -z "$ARG_FORMAT_ONLY" && -z "$ARG_STEPS" ]]; then
|
|
NEED_GODOT=1
|
|
fi
|
|
|
|
if [[ -n "$NEED_GODOT" ]]; then
|
|
if ! command -v godot &> /dev/null; then
|
|
echo "❌ ERROR: Godot is not installed or not in PATH"
|
|
echo
|
|
echo "Installation instructions:"
|
|
echo "1. Download Godot from https://godotengine.org/download"
|
|
echo "2. Add Godot executable to your PATH environment variable"
|
|
echo "3. Or place godot executable in this project directory"
|
|
echo "4. Restart your terminal"
|
|
echo "5. Run this script again"
|
|
echo
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# Check if gdlint and gdformat are available (only if needed)
|
|
NEED_GDTOOLS=""
|
|
if [[ -n "$ARG_LINT_ONLY" ]]; then
|
|
NEED_GDTOOLS=1
|
|
fi
|
|
if [[ -n "$ARG_FORMAT_ONLY" ]]; then
|
|
NEED_GDTOOLS=1
|
|
fi
|
|
if [[ -n "$ARG_STEPS" ]] && ([[ "$CUSTOM_STEPS" == *"lint"* ]] || [[ "$CUSTOM_STEPS" == *"format"* ]]); then
|
|
NEED_GDTOOLS=1
|
|
fi
|
|
if [[ -z "$ARG_TEST_ONLY" && -z "$ARG_STEPS" ]]; then
|
|
NEED_GDTOOLS=1
|
|
fi
|
|
|
|
if [[ -n "$NEED_GDTOOLS" ]]; then
|
|
if ! command -v gdlint &> /dev/null; then
|
|
echo "❌ ERROR: gdlint is not installed or not in PATH"
|
|
echo
|
|
echo "Installation instructions:"
|
|
echo "1. $PIP_CMD install --upgrade \"setuptools<81\""
|
|
echo "2. $PIP_CMD install gdtoolkit==4"
|
|
echo "3. Restart your terminal"
|
|
echo "4. Run this script again"
|
|
echo
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v gdformat &> /dev/null; then
|
|
echo "❌ ERROR: gdformat is not installed or not in PATH"
|
|
echo
|
|
echo "Installation instructions:"
|
|
echo "1. $PIP_CMD install --upgrade \"setuptools<81\""
|
|
echo "2. $PIP_CMD install gdtoolkit==4"
|
|
echo "3. Restart your terminal"
|
|
echo "4. Run this script again"
|
|
echo
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "✅ All dependencies are available. Running development workflow..."
|
|
echo
|
|
|
|
# Build Python command based on arguments
|
|
PYTHON_FULL_CMD="$PYTHON_CMD tools/run_development.py"
|
|
|
|
if [[ -n "$ARG_LINT_ONLY" ]]; then
|
|
PYTHON_FULL_CMD="$PYTHON_FULL_CMD --lint"
|
|
echo "🔍 Running linting only..."
|
|
elif [[ -n "$ARG_FORMAT_ONLY" ]]; then
|
|
PYTHON_FULL_CMD="$PYTHON_FULL_CMD --format"
|
|
echo "🎨 Running formatting only..."
|
|
elif [[ -n "$ARG_TEST_ONLY" ]]; then
|
|
PYTHON_FULL_CMD="$PYTHON_FULL_CMD --test"
|
|
echo "🧪 Running tests only..."
|
|
elif [[ -n "$ARG_STEPS" ]]; then
|
|
PYTHON_FULL_CMD="$PYTHON_FULL_CMD --steps $CUSTOM_STEPS"
|
|
echo "🔄 Running custom workflow: $CUSTOM_STEPS..."
|
|
else
|
|
echo "🚀 Running complete development workflow: format + lint + test..."
|
|
fi
|
|
|
|
echo
|
|
|
|
# Run the Python development workflow script
|
|
$PYTHON_FULL_CMD
|
|
|
|
# Capture exit code and display result
|
|
WORKFLOW_RESULT=$?
|
|
|
|
echo
|
|
if [[ $WORKFLOW_RESULT -eq 0 ]]; then
|
|
echo "🎉 Development workflow completed successfully!"
|
|
else
|
|
echo "⚠️ Development workflow completed with issues."
|
|
echo "Please review the output above and fix any problems."
|
|
fi
|
|
|
|
echo
|
|
exit $WORKFLOW_RESULT
|