@@ -84,30 +84,36 @@ jobs:
8484 image : mariadb:11.5
8585 env :
8686 MARIADB_ROOT_PASSWORD : password
87+ MARIADB_DATABASE : vendure
88+ MARIADB_USER : vendure
89+ MARIADB_PASSWORD : password
8790 ports :
8891 - 3306
8992 options : --health-cmd="mariadb-admin ping -h localhost -u vendure -ppassword" --health-interval=10s --health-timeout=5s --health-retries=3
9093 mysql :
9194 image : vendure/mysql-8-native-auth:latest
9295 env :
9396 MYSQL_ROOT_PASSWORD : password
97+ MYSQL_DATABASE : vendure
98+ MYSQL_USER : vendure
99+ MYSQL_PASSWORD : password
94100 ports :
95101 - 3306
96- options : --health-cmd="mysqladmin ping --silent " --health-interval=10s --health-timeout=20s --health-retries=10
102+ options : --health-cmd="mysqladmin ping -h localhost -u vendure -ppassword " --health-interval=10s --health-timeout=20s --health-retries=10
97103 postgres :
98104 image : postgres:16
99105 env :
100106 POSTGRES_USER : vendure
101107 POSTGRES_PASSWORD : password
102108 ports :
103109 - 5432
104- options : --health-cmd=pg_isready -- health-interval=10s --health-timeout=5s --health-retries=3
110+ options : --health-cmd=" pg_isready -U vendure" -- health-interval=10s --health-timeout=5s --health-retries=10
105111 elastic :
106112 image : docker.elastic.co/elasticsearch/elasticsearch:7.1.1
107113 env :
108114 discovery.type : single-node
109- bootstrap.memory_lock : true
110- ES_JAVA_OPTS : -Xms512m -Xmx512m
115+ bootstrap.memory_lock : " false "
116+ ES_JAVA_OPTS : -Xms256m -Xmx256m
111117 # Elasticsearch will force read-only mode when total available disk space is less than 5%. Since we will
112118 # be running on a shared Azure instance with 84GB SSD, we easily go below 5% available even when there are still
113119 # > 3GB free. So we set this value to an absolute one rather than a percentage to prevent all the Elasticsearch
@@ -117,7 +123,7 @@ jobs:
117123 cluster.routing.allocation.disk.watermark.flood_stage : 100mb
118124 ports :
119125 - 9200
120- options : --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=3
126+ options : --health-cmd="curl --silent --fail localhost:9200/_cluster/health" --health-interval=10s --health-timeout=10s --health-retries=5
121127 redis :
122128 image : redis:7.4.1
123129 ports :
@@ -139,6 +145,40 @@ jobs:
139145 npm install --os=linux --cpu=x64 sharp
140146 - name : Build
141147 run : npx lerna run ci
148+ - name : Wait for services to be ready
149+ run : |
150+ echo "Waiting for required services..."
151+ # Wait for redis
152+ for i in {1..60}; do
153+ if nc -z localhost $E2E_REDIS_PORT; then break; fi
154+ sleep 1
155+ done
156+
157+ # Wait for DB ports depending on matrix value
158+ if [ "$DB" = "postgres" ]; then
159+ for i in {1..60}; do
160+ if nc -z localhost $E2E_POSTGRES_PORT; then break; fi
161+ sleep 1
162+ done
163+ elif [ "$DB" = "mariadb" ]; then
164+ for i in {1..60}; do
165+ if nc -z localhost $E2E_MARIADB_PORT; then break; fi
166+ sleep 1
167+ done
168+ elif [ "$DB" = "mysql" ]; then
169+ for i in {1..60}; do
170+ if nc -z localhost $E2E_MYSQL_PORT; then break; fi
171+ sleep 1
172+ done
173+ fi
174+
175+ # Wait for Elasticsearch
176+ for i in {1..60}; do
177+ if curl --silent --fail http://localhost:$E2E_ELASTIC_PORT/_cluster/health >/dev/null 2>&1; then break; fi
178+ sleep 1
179+ done
180+
181+ echo "Services appear reachable."
142182 - name : e2e tests
143183 env :
144184 E2E_MYSQL_PORT : ${{ job.services.mysql.ports['3306'] }}
0 commit comments