From 3d527f8690e2b9b741bba11457de63554cf11c00 Mon Sep 17 00:00:00 2001 From: Latte Date: Sat, 27 Jun 2026 15:19:43 +0200 Subject: [PATCH] ci: build the package and smoke-test both install profiles Add a package job to the test workflow: uv build, then verify a clean core install excludes the web stack and the aegis-gitea-mcp stdio entry exits 2 with an actionable message, and that the [server] extra pulls in fastapi/uvicorn and imports the server entry. Catches packaging/console-script regressions in CI. --- .gitea/workflows/test.yml | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 573801f..72e2b08 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -31,3 +31,59 @@ jobs: - name: Run tests with coverage gate run: | pytest --cov=aegis_gitea_mcp --cov-report=term-missing --cov-fail-under=80 + + # --------------------------------------------------------------------------- + # Package: build with uv and smoke-test both install profiles so packaging + # regressions (broken console scripts, dependency split) are caught in CI. + # --------------------------------------------------------------------------- + package: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Set up uv + uses: astral-sh/setup-uv@v5 + + - name: Build sdist + wheel + run: uv build + + - name: Smoke-test the core (stdio) install + shell: bash + run: | + WHEEL="$(echo dist/*.whl)" + python -m venv /tmp/core + /tmp/core/bin/pip install --quiet "$WHEEL" + # The core install must NOT pull in the web stack. + if /tmp/core/bin/python -c "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec('fastapi') else 1)"; then + echo "::error::core install unexpectedly includes fastapi" >&2 + exit 1 + fi + # The stdio console script exists and exits 2 with a clear error when + # required env vars are missing (no traceback). + set +e + GITEA_URL= GITEA_TOKEN= /tmp/core/bin/aegis-gitea-mcp >/dev/null 2>/tmp/core_err.txt + rc=$? + set -e + test "$rc" = "2" || { echo "::error::stdio entry exit $rc (expected 2)"; cat /tmp/core_err.txt; exit 1; } + grep -q "GITEA_URL" /tmp/core_err.txt + echo "core stdio entry OK (exit 2, no fastapi)" + + - name: Smoke-test the [server] install + shell: bash + run: | + WHEEL="$(echo dist/*.whl)" + python -m venv /tmp/server + /tmp/server/bin/pip install --quiet "${WHEEL}[server]" + /tmp/server/bin/python -c "import fastapi, uvicorn, aegis_gitea_mcp.server_entry; print('server extra import OK')" + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/*