diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index c1c012c..4f5a906 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -21,8 +21,10 @@ jobs: echo "pytest uses Dev Postgres (${APP_DIR}); event=${{ github.event_name }}" cd "$APP_DIR" for i in $(seq 1 60); do - if [ -f "$APP_DIR/pyproject.toml" ] && docker compose -f "$COMPOSE_FILE" exec -T api true 2>/dev/null; then - echo "api and pyproject.toml ready (attempt $i)" + if [ -f "$APP_DIR/pyproject.toml" ] \ + && grep -q "api-test:" "$COMPOSE_FILE" \ + && docker compose -f "$COMPOSE_FILE" exec -T api true 2>/dev/null; then + echo "api and test profile ready (attempt $i)" break fi if [ "$i" -eq 60 ]; then @@ -45,15 +47,11 @@ jobs: psql -U "$PGUSER" -d postgres -v ON_ERROR_STOP=1 \ -c "CREATE DATABASE buyingagent_test OWNER ${PGUSER};" docker compose -f "$COMPOSE_FILE" --profile test build --pull=false api-test - docker compose -f "$COMPOSE_FILE" --profile test run --rm --no-deps \ - -v "${APP_DIR}:/src:ro" \ - -w /src \ - -e PYTHONPATH=/src \ - -e DB_NAME=buyingagent_test \ - -e ENVIRONMENT=test \ - -e ENGINE_BUILD=test \ - api-test \ - /bin/sh -c '/app/.venv/bin/alembic upgrade head && /app/.venv/bin/pytest tests -m "not slow" -ra --tb=short --cache-dir=/tmp/pytest-cache' + RUN_OPTS="--rm --no-deps -v ${APP_DIR}:/src:ro -w /src -e PYTHONPATH=/src -e DB_NAME=buyingagent_test -e ENVIRONMENT=test -e ENGINE_BUILD=test" + docker compose -f "$COMPOSE_FILE" --profile test run $RUN_OPTS \ + api-test /app/.venv/bin/alembic upgrade head + docker compose -f "$COMPOSE_FILE" --profile test run $RUN_OPTS \ + api-test /app/.venv/bin/pytest tests -ra --tb=short --cache-dir=/tmp/pytest-cache smoke-dev: if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}