#!/bin/bash # Script to deploy basic test files to staging server # Load environment variables source "$(dirname "$0")/../deploy-config-staging.conf" # Check if staging credentials are set if [ -z "$UPSKILL_STAGING_SSH_USER" ] || [ -z "$UPSKILL_STAGING_IP" ] || [ -z "$UPSKILL_STAGING_PATH" ]; then echo "Error: Staging credentials not found in configuration" exit 1 fi # Create test directory on staging echo "Creating test directory on staging..." sshpass -p "$UPSKILL_STAGING_PASS" ssh -o StrictHostKeyChecking=no "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP" \ "mkdir -p $UPSKILL_STAGING_PATH/wp-content/plugins/hvac-community-events/tests/basic" if [ $? -ne 0 ]; then echo "Error: Failed to create test directory on staging" exit 1 fi # Deploy test files echo "Deploying test files..." TEST_FILES=( "tests/basic/bootstrap.php" "tests/basic/test-doubles.php" "tests/basic/test-basic-functionality.php" "tests/basic/run-tests.php" ) for file in "${TEST_FILES[@]}"; do echo "Copying $file..." sshpass -p "$UPSKILL_STAGING_PASS" scp -o StrictHostKeyChecking=no \ "$file" \ "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP:$UPSKILL_STAGING_PATH/wp-content/plugins/hvac-community-events/$file" if [ $? -ne 0 ]; then echo "Error: Failed to copy $file" exit 1 fi done echo "Making test scripts executable..." sshpass -p "$UPSKILL_STAGING_PASS" ssh -o StrictHostKeyChecking=no "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP" \ "chmod +x $UPSKILL_STAGING_PATH/wp-content/plugins/hvac-community-events/tests/basic/run-tests.php" echo "Basic test files deployed successfully" exit 0