Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/scripts/run-backend-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ set -euo pipefail

DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$DIR/local-db.sh"
source "$DIR/run-backend-instance.sh"
source "$DIR/run-frontend-instance.sh"

trap db_cleanup EXIT
trap 'db_cleanup; backend_cleanup; frontend_cleanup' EXIT

java -version
javac -version
Expand All @@ -23,4 +25,10 @@ cd ..

db_startup

./mvnw clean verify -Dspring.profiles.active=ci
backend_startup

frontend_startup

backend_cleanup

./mvnw clean verify -Dspring.profiles.active=ci
48 changes: 48 additions & 0 deletions .github/scripts/run-frontend-instance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash

frontend_cleanup() {
echo "[INFO] ===== FRONTEND LOGS START ====="
cat frontend.log || echo "[WARN] frontend.log not found"
echo "[INFO] ===== FRONTEND LOGS END ====="
if kill $(cat frontend_pid.txt) >/dev/null 2>&1; then
echo "Frontend process killed successfully."
else
echo "Frontend was not running or already stopped."
fi
}

frontend_startup() {
corepack enable pnpm
cd js
pnpm i --frozen-lockfile

echo "Generating API schema..."
pnpm run generate

if [ ! -f "src/lib/api/types/autogen/schema.ts" ]; then
echo "Schema generation failed!"
exit 1
fi
echo "Schema file generated successfully."

pnpm run dev >../frontend.log 2>&1 &
echo $! >../frontend_pid.txt
cd ..

frontend_started=false
for i in {1..30}; do
if curl -s http://localhost:5173/ | grep -q '<title>'; then
echo "Frontend is up!"
frontend_started=true
break
fi
echo "Waiting for frontend... ($i/30)"
sleep 2
done

if [ "$frontend_started" = false ]; then
echo "Frontend failed to start in time."
cat frontend.log || true
exit 1
fi
}