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 16 commits into
base: master
Choose a base branch
from
Draft
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
16 changes: 15 additions & 1 deletion .github/docker/simple-server.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ services:
- "6379"

server:
image: simpledotorg/server:latest
container_name: simple-server
build:
context: https://github.com/simpledotorg/simple-server.git
dockerfile: ./.docker/dev.Dockerfile
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 All @@ -32,3 +35,14 @@ services:
CALL_SESSION_REDIS_HOST: redis
RAILS_CACHE_REDIS_URL: redis://
SIDEKIQ_REDIS_HOST: redis
networks:
- simple-network
- default

networks:
simple-network:
driver: bridge
default:
driver: bridge
driver_opts:
com.docker.network.bridge.host_binding_ipv4: "127.0.0.1"
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://127.0.0.1:8420/api/manifest.json"
timeout_in_seconds=1800 # 30 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
Loading