diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d07425..a700ccf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,13 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Test run: ./test.sh + - name: Check login + run: ./wait_for_login.sh + - name: Check OMERO.web + run: ./check_web.sh - name: Check logs run: docker-compose logs if: ${{ failure() }} diff --git a/check_web.sh b/check_web.sh new file mode 100755 index 0000000..cad5d63 --- /dev/null +++ b/check_web.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +set -u +set -x + +# Wait up to 2 mins +i=0 +while ! docker compose logs 2>&1 | grep 'Listening at: http://0.0.0.0:4080'; do + i=$(($i+1)) + if [ $i -ge 24 ]; then + echo "$(date) - OMERO.web still not listening, giving up" + exit 1 + fi + echo "$(date) - waiting for OMERO.web..." + sleep 5 +done +echo "OMERO.web listening" + +# Check the string "OMERO.web - Login" is present +curl -sL localhost:4080 | grep 'OMERO.web - Login' diff --git a/docker-compose.yml b/docker-compose.yml index 73fa149..e8505a9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3" services: database: - image: "postgres:11" + image: "postgres:14" environment: POSTGRES_USER: omero POSTGRES_DB: omero diff --git a/test.sh b/test.sh index 8c7f1f1..aed3403 100755 --- a/test.sh +++ b/test.sh @@ -2,4 +2,3 @@ set -eu docker compose up -d -./wait_for_login.sh diff --git a/wait_for_login.sh b/wait_for_login.sh index d5bc116..09b4476 100755 --- a/wait_for_login.sh +++ b/wait_for_login.sh @@ -7,5 +7,6 @@ OMERO_PASS=omero OMERO=/opt/omero/server/OMERO.server/bin/omero # Wait up to 2 mins +echo "Establishing connection with OMERO.server" docker compose exec -T omeroserver $OMERO login -C -s localhost -u "$OMERO_USER" -q -w "$OMERO_PASS" --retry 120 echo "OMERO.server connection established"