Merge pull request #220 from openzim/healthcheck-fixes #13
This file contains hidden or 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: Healthcheck Tests | |
| on: | |
| pull_request: | |
| paths: | |
| - "healthcheck/**" | |
| push: | |
| paths: | |
| - "healthcheck/**" | |
| branches: | |
| - main | |
| jobs: | |
| run-tests: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Retrieve source code | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: healthcheck/pyproject.toml | |
| architecture: x64 | |
| - name: Build healthcheck Docker image | |
| working-directory: healthcheck | |
| run: docker build -t cms-healthcheck:test . | |
| - name: Run healthcheck container | |
| run: | | |
| docker run -d --name cms-healthcheck-test \ | |
| -e CMS_API_URL=http://localhost:8001 \ | |
| -e CMS_FRONTEND_URL=http://localhost:8002 \ | |
| -e CMS_USERNAME=admin \ | |
| -e CMS_PASSWORD=admin_pass \ | |
| -e CMS_DATABASE_URL=postgresql+psycopg://cms:cmspass@localhost:5432/cmstest \ | |
| -p 8000:80 \ | |
| cms-healthcheck:test | |
| # wait for container to be ready | |
| for i in {1..10}; do | |
| if curl -s http://localhost:8000 > /dev/null; then | |
| echo "Healthcheck is up!" | |
| break | |
| fi | |
| echo "Waiting for Healthcheck..." | |
| sleep 3 | |
| done |