Skip to content

Commit

Permalink
feat: Update docker-test.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoubagrebi authored Apr 16, 2024
1 parent a51653a commit 351b9b2
Showing 1 changed file with 14 additions and 54 deletions.
68 changes: 14 additions & 54 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,21 @@
name: Docker Compose Test
name: Run Docker Compose Test

on:
workflow_dispatch:
schedule:
push:
branches: [ main ]
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

env:
WALLET_BACKEND_PORT: 7001
ISSUER_API_PORT: 7002
VERIFIER_API_PORT: 7003

jobs:
docker-compose:
runs-on: ubuntu-latest
services:
docker:
image: docker:20.10.8
options: --privileged
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v1
- uses: actions/checkout@v3

- uses: hoverkraft-tech/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Pull Docker Images
run: docker-compose pull
- name: Run Docker Compose
run: docker-compose up -d
- name: Check container health
id: healthcheck
run: |
for container in wallet-api issuer-api verifier-api waltid-web-wallet web-portal vc-repo db phpmyadmin caddy; do
container_status=$(docker inspect --format='{{.State.Health.Status}}' $container)
if [ "$container_status" != "healthy" ]; then
echo "::error ::Container $container is not healthy"
exit 1
fi
done
- name: Check container logs for errors
run: |
for container in wallet-api issuer-api verifier-api waltid-web-wallet web-portal vc-repo db phpmyadmin caddy; do
if docker logs $container 2>&1 | grep -q "ERROR"; then
echo "::error ::Error found in container $container logs"
exit 1
fi
done
- name: Check application endpoints
run: |
for container_port in ${{ env.WALLET_BACKEND_PORT }} ${{ env.ISSUER_API_PORT }} ${{ env.VERIFIER_API_PORT }}; do
if [ -z "$container_port" ]; then
continue
fi
response=$(curl --silent --fail --output /dev/null --write-out '%{http_code}' http://localhost:$container_port)
if [ "$response" != "200" ]; then
echo "::error ::Application endpoint returned an error: $response"
exit 1
fi
done
compose-file: "./docker-compose/docker-compose.yaml"
services: |
issuer-api

0 comments on commit 351b9b2

Please sign in to comment.