87 lines
2.5 KiB
Bash
87 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
# Build and Test Script for gitadmin/test-repo-REAL-WORKING
|
|
echo "=== Build and Test Script for gitadmin/test-repo-REAL-WORKING ==="
|
|
echo "Latest commit: Testing"
|
|
echo
|
|
|
|
# Check if git is installed
|
|
if ! command -v git &> /dev/null; then
|
|
echo "Git is not installed. Installing git..."
|
|
apt-get update && apt-get install -y git
|
|
fi
|
|
|
|
# Clone the repository if it doesn't exist
|
|
if [ ! -d "test-repo-REAL-WORKING" ]; then
|
|
echo "Cloning repository gitadmin/test-repo-REAL-WORKING from main branch..."
|
|
git clone -b main https://github.com/gitadmin/test-repo-REAL-WORKING.git
|
|
cd test-repo-REAL-WORKING
|
|
else
|
|
echo "Repository already exists. Pulling latest changes..."
|
|
cd test-repo-REAL-WORKING
|
|
git pull origin main
|
|
fi
|
|
|
|
echo "Current directory contents:"
|
|
ls -la
|
|
echo
|
|
|
|
# Check project type and build
|
|
echo "=== Analyzing Project Structure ==="
|
|
if [ -f "package.json" ]; then
|
|
echo "Node.js project detected (package.json found)"
|
|
echo "Installing dependencies..."
|
|
npm install
|
|
echo "Building project..."
|
|
if [ -f "package.json" ]; then
|
|
if grep -q '"build"' package.json; then
|
|
npm run build
|
|
else
|
|
echo "No build script found in package.json"
|
|
fi
|
|
fi
|
|
elif [ -f "requirements.txt" ]; then
|
|
echo "Python project detected (requirements.txt found)"
|
|
echo "Installing dependencies..."
|
|
pip install -r requirements.txt
|
|
echo "Running Python build tasks..."
|
|
elif [ -f "Dockerfile" ]; then
|
|
echo "Docker project detected (Dockerfile found)"
|
|
echo "Building Docker image..."
|
|
docker build -t test-repo-real-working .
|
|
elif [ -f "Makefile" ]; then
|
|
echo "Makefile project detected"
|
|
echo "Running make build..."
|
|
make build
|
|
else
|
|
echo "No standard build configuration found"
|
|
echo "Checking for common files..."
|
|
ls -la
|
|
fi
|
|
|
|
echo
|
|
echo "=== Running Tests ==="
|
|
if [ -f "package.json" ]; then
|
|
if grep -q '"test"' package.json; then
|
|
echo "Running npm tests..."
|
|
npm test
|
|
else
|
|
echo "No npm test script found"
|
|
fi
|
|
elif [ -f "pytest.ini" ] || [ -f "pyproject.toml" ]; then
|
|
echo "Running pytest..."
|
|
pytest
|
|
elif [ -f "Makefile" ]; then
|
|
echo "Running make test..."
|
|
make test
|
|
elif [ -f "docker-compose.yml" ]; then
|
|
echo "Running docker-compose tests..."
|
|
docker-compose run test
|
|
else
|
|
echo "No standard test configuration found"
|
|
echo "Available test files:"
|
|
find . -name "*test*" -o -name "*spec*"
|
|
fi
|
|
|
|
echo
|
|
echo "=== Build and Test Complete ===" |