📝 docs: Update README.md for image formatting and changed images #26
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: Test API Predict | |
on: | |
push: | |
branches: ["master"] | |
pull_request: | |
branches: ["master"] | |
jobs: | |
test-api: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.12" | |
- name: Install test dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest requests | |
- name: Create Docker network | |
run: docker network create backend | |
- name: Build and start API container | |
run: | | |
docker compose -f app/docker-compose.yml up -d api-predict --build | |
- name: Wait for API to be ready | |
run: | | |
timeout 60s bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8002/model_info)" != "200" ]]; do sleep 1; done' || false | |
- name: Run API tests | |
run: | | |
pytest tests/test_api_predict.py -v | |
- name: Docker logs on failure | |
if: failure() | |
run: docker compose -f app/docker-compose.yml logs api-predict | |
- name: Stop containers | |
if: always() | |
run: | | |
docker compose -f app/docker-compose.yml down | |
docker network rm backend |