Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Docker server for running integration tests in CI #5148

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
7 changes: 6 additions & 1 deletion .github/docker/simple-server.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ services:
- "6379"

server:
image: simpledotorg/server:latest
build:
context: https://github.com/simpledotorg/simple-server.git
dockerfile: ./.docker/dev.Dockerfile
image: simple-server:latest
volumes:
- .:/myapp
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rake db:setup; bundle exec rails s -p 3000 -b '0.0.0.0'"
expose:
- "3000"
Expand Down
28 changes: 28 additions & 0 deletions .github/scripts/wait_for_docker_server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

docker network inspect backend

url="http://localhost:8420"
timeout_in_seconds=3600 # 60 minutes in seconds

start_time=$(date +%s)

while true; do
response_code=$(curl -s -o /dev/null -w "%{http_code}" "$url")

if [ "$response_code" -eq 200 ]; then
echo "Success! Received 200 OK response."
break
else
echo "Failed, got $response_code as response code. Retrying..."
sleep 5

current_time=$(date +%s)
elapsed_time=$((current_time - start_time))

if [ "$elapsed_time" -ge "$timeout_in_seconds" ]; then
echo "Timeout reached. Exiting."
exit 1
fi
fi
done
Loading