From de27820cc7d5f405d3d249ecfc721465b1f170c9 Mon Sep 17 00:00:00 2001 From: OpenCode Cabillot Date: Fri, 9 Oct 2026 00:18:25 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20run=20pytest=20in=20all=20workflows=20?= =?UTF-8?q?=E2=80=94=20real=20unit=20job=20+=20Qdrant-backed=20integration?= =?UTF-8?q?=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - pr.yaml: new pytest job (unit tests only, integration deselected by marker) - main.yaml / cron.yaml / tag.yaml: replace the build-only 'test' job with a real pytest unit job + an integration-test job that starts a Qdrant container sharing the job container's network namespace (--network container:$(hostname) — bypasses the Gitea runner bug with service containers), waits for /healthz, runs 'pytest -m integration', then tears down. - build/build-push jobs now require [test, integration-test]; previously 'test' was only a docker build and pytest never ran in CI. - integration-test first cleans up any stale qdrant container (rerun-safe). - setup-python SHA aligned with docker-build.yaml (v7, python 3.13/3.14). --- .gitea/workflows/cron.yaml | 55 +++++++++++++++++++++++++++++++++++--- .gitea/workflows/main.yaml | 55 +++++++++++++++++++++++++++++++++++--- .gitea/workflows/pr.yaml | 18 ++++++++++++- .gitea/workflows/tag.yaml | 55 +++++++++++++++++++++++++++++++++++--- 4 files changed, 173 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/cron.yaml b/.gitea/workflows/cron.yaml index cda5d0b..6c930c8 100644 --- a/.gitea/workflows/cron.yaml +++ b/.gitea/workflows/cron.yaml @@ -18,11 +18,60 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 - - run: docker build -f pkg/Dockerfile -t ci-image:${{ github.sha }} . + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run unit tests + run: pytest tests/ -v + env: + # indexer/server read env at import; unit tests need no real backend + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test + + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + + - name: Cleanup old Qdrant container + run: | + docker rm -f mcp-maildir-ci-qdrant 2>/dev/null || true + + - name: Start Qdrant + run: | + docker run -d --name mcp-maildir-ci-qdrant \ + --network "container:$(hostname)" \ + docker.io/qdrant/qdrant:latest + + - name: Wait for Qdrant + run: | + for i in $(seq 1 30); do + curl -s http://localhost:6333/healthz \ + && echo "QDRANT ready" && break + echo "Waiting for Qdrant... ($i/30)" + sleep 1 + done + curl -s http://localhost:6333/healthz > /dev/null + + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run integration tests + run: pytest tests/ -v -m integration + env: + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test_mcp_maildir + + - name: Cleanup Qdrant + if: always() + run: docker rm -f mcp-maildir-ci-qdrant || true build-push: - needs: [test] + needs: [test, integration-test] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml index fecf74b..db628e9 100644 --- a/.gitea/workflows/main.yaml +++ b/.gitea/workflows/main.yaml @@ -18,11 +18,60 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 - - run: docker build -f pkg/Dockerfile -t ci-image:${{ github.sha }} . + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run unit tests + run: pytest tests/ -v + env: + # indexer/server read env at import; unit tests need no real backend + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test + + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + + - name: Cleanup old Qdrant container + run: | + docker rm -f mcp-maildir-ci-qdrant 2>/dev/null || true + + - name: Start Qdrant + run: | + docker run -d --name mcp-maildir-ci-qdrant \ + --network "container:$(hostname)" \ + docker.io/qdrant/qdrant:latest + + - name: Wait for Qdrant + run: | + for i in $(seq 1 30); do + curl -s http://localhost:6333/healthz \ + && echo "QDRANT ready" && break + echo "Waiting for Qdrant... ($i/30)" + sleep 1 + done + curl -s http://localhost:6333/healthz > /dev/null + + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run integration tests + run: pytest tests/ -v -m integration + env: + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test_mcp_maildir + + - name: Cleanup Qdrant + if: always() + run: docker rm -f mcp-maildir-ci-qdrant || true build: - needs: [test] + needs: [test, integration-test] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 diff --git a/.gitea/workflows/pr.yaml b/.gitea/workflows/pr.yaml index 48735fa..47e08fd 100644 --- a/.gitea/workflows/pr.yaml +++ b/.gitea/workflows/pr.yaml @@ -14,9 +14,25 @@ jobs: with: dockerfile: pkg/Dockerfile + pytest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run unit tests + run: pytest tests/ -v + env: + # indexer/server read env at import; unit tests need no real backend + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test + build-test: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 - - run: docker build -f pkg/Dockerfile -t ci-image:${{ github.sha }} . \ No newline at end of file + - run: docker build -f pkg/Dockerfile -t ci-image:${{ github.sha }} . diff --git a/.gitea/workflows/tag.yaml b/.gitea/workflows/tag.yaml index b90cfcd..6458f7b 100644 --- a/.gitea/workflows/tag.yaml +++ b/.gitea/workflows/tag.yaml @@ -18,11 +18,60 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4 - - run: docker build -f pkg/Dockerfile -t ci-image:${{ github.sha }} . + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run unit tests + run: pytest tests/ -v + env: + # indexer/server read env at import; unit tests need no real backend + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test + + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + + - name: Cleanup old Qdrant container + run: | + docker rm -f mcp-maildir-ci-qdrant 2>/dev/null || true + + - name: Start Qdrant + run: | + docker run -d --name mcp-maildir-ci-qdrant \ + --network "container:$(hostname)" \ + docker.io/qdrant/qdrant:latest + + - name: Wait for Qdrant + run: | + for i in $(seq 1 30); do + curl -s http://localhost:6333/healthz \ + && echo "QDRANT ready" && break + echo "Waiting for Qdrant... ($i/30)" + sleep 1 + done + curl -s http://localhost:6333/healthz > /dev/null + + - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7 + with: + python-version: "3.13" + - name: Install dependencies + run: pip install -r requirements.txt pytest + - name: Run integration tests + run: pytest tests/ -v -m integration + env: + QDRANT_URL: http://localhost:6333 + COLLECTION_NAME: test_mcp_maildir + + - name: Cleanup Qdrant + if: always() + run: docker rm -f mcp-maildir-ci-qdrant || true build-push: - needs: [test] + needs: [test, integration-test] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7