51 lines
1.4 KiB
Bash
Executable File
51 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# =====================================================================
|
|
# pre-test-setup.sh - Setup environment before running tests
|
|
# =====================================================================
|
|
# This script sets up the environment before running tests:
|
|
# 1. Generates sitemap.xml
|
|
# 2. Updates CSP hashes
|
|
# =====================================================================
|
|
|
|
set -e
|
|
|
|
echo "=== Setting up test environment ==="
|
|
|
|
# Get the directory of this script
|
|
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
|
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
RESUME_DIR="$PROJECT_ROOT/docker/resume"
|
|
|
|
# Check if we're in the right directory
|
|
if [ ! -d "$RESUME_DIR" ]; then
|
|
echo "❌ Could not find resume directory at $RESUME_DIR"
|
|
exit 1
|
|
fi
|
|
|
|
# Change to the resume directory
|
|
cd "$RESUME_DIR"
|
|
|
|
# Run update scripts
|
|
if [ -f "./update-all.sh" ]; then
|
|
echo "=== Running update-all.sh ==="
|
|
./update-all.sh
|
|
else
|
|
# Run individual scripts if update-all.sh doesn't exist
|
|
if [ -f "./generate-sitemap.sh" ]; then
|
|
echo "=== Generating sitemap.xml ==="
|
|
./generate-sitemap.sh
|
|
else
|
|
echo "⚠️ generate-sitemap.sh not found, skipping sitemap generation"
|
|
fi
|
|
|
|
if [ -f "./update-csp-hashes.sh" ]; then
|
|
echo "=== Updating CSP hashes ==="
|
|
./update-csp-hashes.sh
|
|
else
|
|
echo "⚠️ update-csp-hashes.sh not found, skipping CSP hash updates"
|
|
fi
|
|
fi
|
|
|
|
echo "=== Test environment setup complete ==="
|
|
exit 0
|