name: API Tests (pytest) on: push: branches: [ main ] pull_request: branches: [ main ] jobs: test-api: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip pip install requests pytest - name: Wait for API to be ready run: | echo "Waiting for API at localhost:80..." for i in {1..10}; do if curl -s http://localhost:80 >/dev/null; then echo "API is up!" exit 0 fi echo "Retry $i..." sleep 3 done echo "API did not start in time." exit 1 - name: Run pytest run: pytest tests_r/ --maxfail=1 --disable-warnings -v