Skip to content

chore: add CI workflow to run offline unit tests on push/PR #17

Description

@pinecone-groundskeeper

Problem

The repository has no .github/workflows/ directory at all, so nothing runs tests/test_query.py — the 10 offline unit tests that mock pinecone.Pinecone and google.genai.Client at import time and need no network access or API keys. A dependency bump or code change could silently break query.py's request-shape assumptions with nothing catching it before merge.

Solution

Add .github/workflows/ci.yml: a single job that installs requirements.txt plus pytest, then runs pytest tests/test_query.py on every push and pull_request. It uses an explicit least-privilege permissions: contents: read block and fails the job on any non-zero pytest exit code (the default behavior of a failing shell step).

tests/test_live.py is intentionally excluded — its own docstring notes it hits the real Pinecone/Gemini index and requires live credentials this repo doesn't provision for CI.

Verification

Confirmed locally (offline, no live credentials):

$ pytest tests/test_query.py -q
..........                                                              [100%]
10 passed in 0.28s

Note: the mocked tests patch sys.modules["pinecone"] / sys.modules["google.genai"] before query.py imports them, so only python-dotenv needs to actually be importable for query.py's module-level load_dotenv() call — the workflow still installs the full requirements.txt to match a real CI environment and catch install-time breakage too.

Follow-ups

Out of scope here, per the issue: linting/formatting enforcement, coverage thresholds, a build/release pipeline, and wiring up test_live.py (needs secrets not provisioned for CI).

Closes #11

Generated by GitHub Maintenance Fixer · sonnet50 · 82.9 AIC · ⌖ 17.3 AIC · ⊞ 8.1K · ◷


Note

This was originally intended as a pull request, but the git push operation failed.

Original error: The process '/usr/bin/git' failed with exit code 128

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 30747570815 -n agent -D /tmp/agent-30747570815

# Fetch the bundle into a temporary ref, then update the local branch
git fetch /tmp/agent-30747570815/aw-pinecone-io-bird-search-example-agent-maintenance-issue-11.bundle refs/heads/agent/maintenance/issue-11:refs/bundles/create-pr-agent-maintenance-issue-11-40807bcd7d5d0f8d-a1ac952a
git update-ref refs/heads/agent/maintenance/issue-11-40807bcd7d5d0f8d refs/bundles/create-pr-agent-maintenance-issue-11-40807bcd7d5d0f8d-a1ac952a
git checkout agent/maintenance/issue-11-40807bcd7d5d0f8d
# Ensure the working tree matches the updated branch
git reset --hard
# Remove the temporary bundle ref
git update-ref -d refs/bundles/create-pr-agent-maintenance-issue-11-40807bcd7d5d0f8d-a1ac952a

# Push the branch to origin
git push origin agent/maintenance/issue-11-40807bcd7d5d0f8d

# Create the pull request
gh pr create --title 'chore: add CI workflow to run offline unit tests on push/PR' --base main --head agent/maintenance/issue-11-40807bcd7d5d0f8d --repo pinecone-io/bird-search-example

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent:maintenanceOpened/maintained by the maintenance agent; it recognizes its own work by this labelagentic-workflowsci

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions