Add new docker-compose dev env #14
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] | |
schedule: | |
- cron: "0 0 * * *" | |
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: Wait for containers to start | |
run: make build | |
- name: Run docker-compose up -d | |
run: make run | |
# Wait for containers to start up (adjust the sleep time as needed) | |
- name: Wait for containers to start | |
run: sleep 20 | |
- 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 | |
- name: load tests requirements | |
run: pip install -r tests/requirements.txt | |
- name: launch tests | |
run: python tests/alerts.py |