-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tiago Góes <[email protected]>
- Loading branch information
1 parent
26001ca
commit f059da3
Showing
4 changed files
with
42 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,10 @@ on: | |
branches: [ "main" ] | ||
env: | ||
SHA: ${{ github.sha }} | ||
POSTGRES_USER: ${{ secrets.POSTGRES_USER }} | ||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
POSTGRES_DB: ${{ secrets.POSTGRES_DB }} | ||
POSTGRES_HOST: ${{ secrets.POSTGRES_HOST }} | ||
|
||
jobs: | ||
run-api-tests: | ||
|
@@ -13,38 +17,38 @@ jobs: | |
- uses: actions/checkout@v4 | ||
|
||
- name: Start containers | ||
uses: hoverkraft-tech/[email protected] | ||
env: | ||
SHA: ${{ env.SHA }} | ||
up-flags: "--force-recreate" | ||
run: | | ||
docker compose build | ||
docker image ls | ||
docker compose up -d --force-recreate | ||
- name: Wait for containers | ||
run: | | ||
docker ps | ||
docker logs database | ||
max_attempts=3 | ||
attempt=1 | ||
# max_attempts=3 | ||
# attempt=1 | ||
while [ $attempt -le $max_attempts ]; do | ||
if curl -s http://0.0.0.0:8080/health | grep -q '"status":"OK"'; then | ||
echo "Container is up and healthy!" | ||
break | ||
else | ||
echo "Attempt $attempt/$max_attempts: Waiting for container..." | ||
attempt=$((attempt + 1)) | ||
if [ $attempt -le $max_attempts ]; then | ||
sleep 60 # Wait for 60 seconds before the next attempt | ||
fi | ||
fi | ||
done | ||
# while [ $attempt -le $max_attempts ]; do | ||
# if curl -s http://0.0.0.0:8080/health | grep -q '"status":"OK"'; then | ||
# echo "Container is up and healthy!" | ||
# break | ||
# else | ||
# echo "Attempt $attempt/$max_attempts: Waiting for container..." | ||
# attempt=$((attempt + 1)) | ||
# if [ $attempt -le $max_attempts ]; then | ||
# sleep 60 # Wait for 60 seconds before the next attempt | ||
# fi | ||
# fi | ||
# done | ||
if [ $attempt -gt $max_attempts ]; then | ||
echo "Container failed to become healthy after $max_attempts attempts." | ||
exit 1 | ||
fi | ||
# if [ $attempt -gt $max_attempts ]; then | ||
# echo "Container failed to become healthy after $max_attempts attempts." | ||
# exit 1 | ||
# fi | ||
- name: Test | ||
run: go test -v ./... | ||
# - name: Test | ||
# run: go test -v ./... | ||
|
||
# build-push-docker-image: | ||
# runs-on: ubuntu-latest | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters