Utility script to cleanly run all tests through Docker.

Based on and perhaps good to use in GH action.
pull/1683/head
Mathijs de Bruin 2025-05-19 12:58:44 +01:00
rodzic 4a43d18de3
commit 8cb9352eaf
1 zmienionych plików z 30 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,30 @@
#!/bin/bash
export COMPOSE_FILE=docker-compose.yml:docker-compose.build.yml
WAIT_SECONDS=20
# Function to run on script exit (success or failure)
cleanup() {
echo "🧹 Cleaning up Docker environment..."
docker compose down -v --remove-orphans
}
# Register the cleanup function to run on script exit
trap cleanup EXIT
# Stop on first error for build and up
set -e
echo "🔨 Building and starting containers..."
docker compose build --build-arg TEST_BUILD=ON
docker compose up --wait
# Wait for services to be ready
echo "⏳ Waiting $WAIT_SECONDS for services to initialize..."
sleep $WAIT_SECONDS
echo "🧪 Running tests..."
# Pass remaining arguments
docker compose exec -T webapp /webodm/webodm.sh test "$@"
echo "✅ Tests completed successfully!"