Skip to content

Update README.md, work in progress. #8

Update README.md, work in progress.

Update README.md, work in progress. #8

Workflow file for this run

name: Test API Predict
on:
push:
branches: ["master", "mike-08"]
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 build api-predict
docker compose up -d api-predict
- name: Check container content
run: |
echo "Contenu du dossier /app:"
docker exec api-predict ls -la /app
echo "Contenu du dossier /app/predict:"
docker exec api-predict ls -la /app/predict
- name: Wait for API to be ready
run: |
timeout 240s 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 logs api-predict
- name: Stop containers
if: always()
run: |
docker compose down
docker network rm backend