From 6be1384392fe359826e8100e2d5e9c9026de64e0 Mon Sep 17 00:00:00 2001 From: Samir Rodas Date: Thu, 8 Aug 2024 17:29:10 -0500 Subject: [PATCH] add jobs --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ Makefile | 14 +++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b423487..7278d44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,5 +22,26 @@ jobs: - name: ๐Ÿณ Start all the environment run: make start-docker + - name: ๐Ÿฆญ Wait for the database to get up + run: | + while ! make ping-mysql &>/dev/null; do + echo "Waiting for database connection..." + sleep 2 + done + + - name: ๐Ÿงช Wait for the elasticsearch to get up + run: | + while ! make ping-elasticsearch &>/dev/null; do + echo "Waiting for elasticsearch connection..." + sleep 2 + done + + - name: ๐Ÿฐ Wait for the message broker to get up + run: | + while ! make ping-rabbitmq &>/dev/null; do + echo "Waiting for RabbitMQ connection..." + sleep 2 + done + - name: โœ… Run the tests run: make test \ No newline at end of file diff --git a/Makefile b/Makefile index ccca5f2..7de4b6c 100644 --- a/Makefile +++ b/Makefile @@ -110,4 +110,16 @@ start-docker stop-docker destroy-docker: composer-env-file rebuild-docker: composer-env-file make deps make start-docker - docker compose build --pull --force-rm --no-cache \ No newline at end of file + docker compose build --pull --force-rm --no-cache + +.PHONY: ping-mysql +ping-mysql: + @docker exec librarify-php_ddd_mysql mysqladmin --user=root --password= --host "127.0.0.1" ping --silent + +.PHONY: ping-elasticsearch +ping-elasticsearch: + @curl -I -XHEAD localhost:9200 + +.PHONY: ping-rabbitmq +ping-rabbitmq: + @docker exec librarify-php_ddd-rabbitmq rabbitmqctl ping --silent \ No newline at end of file