Some checks failed
Backend Actions / check (push) Failing after 3m26s
Frontend Actions / check (push) Failing after 3m17s
Backend Actions / test (push) Failing after 3m20s
Frontend Actions / test (push) Successful in 51s
Frontend Actions / build (push) Successful in 56s
Backend Actions / build (push) Failing after 10m57s
45 lines
1.1 KiB
Bash
Executable File
45 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
POSTGRES_URL=${POSTGRES_URL:-"postgresql://postgres:postgres@localhost:5432"}
|
|
|
|
if ! command -v cargo-nextest > /dev/null 2>&1; then
|
|
echo "Command not found cargo-nextest"
|
|
echo "Try installing with cargo install cargo-nextest"
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v sqlx > /dev/null 2>&1; then
|
|
echo "Command not found sqlx"
|
|
echo "Try installing with cargo install sqlx-cli"
|
|
exit 1
|
|
fi
|
|
|
|
export DATABASE_URL="$POSTGRES_URL/nuchat_dev"
|
|
|
|
if [ -z "$SKIP_DOCKER" ]; then
|
|
# force restart database so no connections
|
|
# prevent database from being dropped
|
|
docker compose -f ../docker-compose.yml down
|
|
docker compose -f ../docker-compose.yml up -d db
|
|
sleep 1
|
|
fi
|
|
|
|
# recreate database and tables
|
|
sqlx database drop -y
|
|
sqlx database create
|
|
sqlx migrate run
|
|
|
|
if [ ! -d logs ]; then
|
|
mkdir logs
|
|
fi
|
|
|
|
# ensure server is not started
|
|
curl -s -X POST localhost:7001/admin/shutdown 2>&1 > /dev/null
|
|
|
|
# start server
|
|
cargo run -- --port 7001 --postgres-url "$POSTGRES_URL" --database "nuchat_dev" 2>&1 > logs/nuchat.log &
|
|
|
|
sleep 1
|
|
# run tests
|
|
cargo nextest run --color=always --no-fail-fast 2>&1 | tee logs/test-output.log
|