barkey/setup-tests.sh

45 lines
951 B
Bash
Executable file

#!/bin/bash
echo "This script will destroy the following local directories:"
echo " ./built"
echo " ./db"
echo " ./redis"
echo
echo "Do you want to continue? [Y/n]"
read -p "> " confirmation
case $confirmation in
[Yy]* )
echo "Continuing..."
;;
[Nn] )
echo "Exiting..."
exit 0
;;
esac
cp .config/ci.yml .config/default.yml
cp .config/ci.yml .config/test.yml
cp .config/docker_ci.env .config/docker.env
cp compose.local-test.yml compose.yml
echo Verifying containers are down...
docker compose down
docker compose rm
echo Removing any preexisting builds and databases.
echo This may take a few moments...
rm -rf ./built ./db ./redis
echo Creating environment
docker compose up -d
docker compose exec web apt-get update
docker compose exec web apt-get install -y bash
echo Building and running tests...
docker compose exec web /host/tests.sh
echo Cleaning up...
docker compose down
docker compose rm
rm -f compose.yml