Add new docker-compose dev env #8
Workflow file for this run
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
name: Docker Compose Up and Health Check | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
jobs: | |
docker-compose-up: | |
name: Docker Compose Up | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python: [3.9] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Run docker-compose up -d | |
run: docker-compose up -d | |
# Wait for containers to start up (adjust the sleep time as needed) | |
- name: Wait for containers to start | |
run: sleep 10 | |
- name: Check container health | |
run: docker-compose ps --filter "status=unhealthy" --quiet | |
continue-on-error: true | |
id: check_health | |
- name: Print container health status | |
run: |- | |
if [ -z "${{ steps.check_health.outputs.stdout }}" ]; then | |
echo "All containers are healthy" | |
exit 0 | |
else | |
echo "Some containers are unhealthy" | |
exit 1 | |
fi | |
- name: Check container logs for errors | |
run: |- | |
docker-compose logs --tail=100 | grep -i -E "error|exception" | |
if [ $? -eq 0 ]; then | |
echo "Found errors in logs" | |
exit 1 | |
else | |
echo "No errors found in logs |