From 8599711fad654d6f5565dfce41f60aacc47870ec Mon Sep 17 00:00:00 2001 From: mikhael <52800123+mikhaelbenilouz@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:18:27 +0100 Subject: [PATCH] modif github action --- .github/workflows/test-api.yml | 70 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test-api.yml b/.github/workflows/test-api.yml index 8449a8b..fd588ab 100644 --- a/.github/workflows/test-api.yml +++ b/.github/workflows/test-api.yml @@ -2,44 +2,44 @@ name: Test API Predict on: push: - branches: [ "master" ] + branches: ["master", "mike-08"] pull_request: - branches: [ "master" ] + 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: Build and start API container - run: | - docker compose build api_predict - docker compose up -d api_predict - - - name: Wait for API to be ready - run: | - timeout 30s 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 + - 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: Build and start API container + run: | + docker compose build api_predict + docker compose up -d api_predict + + - name: Wait for API to be ready + run: | + timeout 30s 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