diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30ed7aa..0512e04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,8 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 env: - SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }} + SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY || secrets.SERPAPI_KEY }} + SERPAPI_KEY: ${{ secrets.SERPAPI_KEY || secrets.SERPAPI_API_KEY }} steps: - name: Check out the pull request @@ -72,8 +73,8 @@ jobs: - name: Require the SerpApi repository secret shell: bash run: | - if [[ -z "${SERPAPI_API_KEY}" ]]; then - echo "Add SERPAPI_API_KEY as a GitHub Actions repository secret." >&2 + if [[ -z "${SERPAPI_API_KEY}" && -z "${SERPAPI_KEY}" ]]; then + echo "Add SERPAPI_API_KEY or SERPAPI_KEY as a GitHub Actions repository secret." >&2 exit 1 fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 190e1c2..2291f98 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,40 @@ jobs: - name: Test run: uv run pytest + live: + name: Live SerpApi integration + needs: test + runs-on: ubuntu-latest + timeout-minutes: 10 + env: + SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY || secrets.SERPAPI_KEY }} + SERPAPI_KEY: ${{ secrets.SERPAPI_KEY || secrets.SERPAPI_API_KEY }} + + steps: + - name: Check out the released revision + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 + + - name: Install uv and Python 3.14 + uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 + with: + version: "0.11.30" + python-version: "3.14" + enable-cache: true + + - name: Install locked dependencies + run: uv sync --locked --dev + + - name: Require the SerpApi repository secret + shell: bash + run: | + if [[ -z "${SERPAPI_API_KEY}" && -z "${SERPAPI_KEY}" ]]; then + echo "Add SERPAPI_API_KEY or SERPAPI_KEY as a GitHub Actions repository secret." >&2 + exit 1 + fi + + - name: Test real web, Maps, News, and Shopping responses + run: uv run pytest -m live + build: name: Build release distributions needs: test @@ -108,7 +142,7 @@ jobs: publish: name: Publish to PyPI - needs: verify-distributions + needs: [verify-distributions, live] runs-on: ubuntu-latest environment: name: pypi diff --git a/README.md b/README.md index 3590cba..dc0cc39 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # SerpApi for Hermes Agent +[![PyPI version](https://img.shields.io/pypi/v/serpapi-hermes-plugin.svg)](https://pypi.org/project/serpapi-hermes-plugin/) +[![CI](https://github.com/serpapi/serpapi-hermes-plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/serpapi/serpapi-hermes-plugin/actions/workflows/ci.yml) +[![Python versions](https://img.shields.io/pypi/pyversions/serpapi-hermes-plugin.svg)](https://pypi.org/project/serpapi-hermes-plugin/) +[![License: MIT](https://img.shields.io/pypi/l/serpapi-hermes-plugin.svg)](https://github.com/serpapi/serpapi-hermes-plugin/blob/main/LICENSE) + Give [Hermes Agent](https://hermes-agent.nousresearch.com/) fast, fresh search results from the web, Google Maps, Google News, and Google Shopping with [SerpApi](https://serpapi.com/). @@ -156,9 +161,9 @@ Example prompts: ## Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, tests, pull request -guidelines, and the release process. +See [CONTRIBUTING.md](https://github.com/serpapi/serpapi-hermes-plugin/blob/main/CONTRIBUTING.md) +for development setup, tests, pull request guidelines, and the release process. ## License -[MIT](LICENSE) +[MIT](https://github.com/serpapi/serpapi-hermes-plugin/blob/main/LICENSE) diff --git a/tests/test_project_metadata.py b/tests/test_project_metadata.py deleted file mode 100644 index 1ead3c6..0000000 --- a/tests/test_project_metadata.py +++ /dev/null @@ -1,27 +0,0 @@ -import tomllib -from pathlib import Path - -ROOT = Path(__file__).parents[1] - - -def test_project_urls_use_the_serpapi_repository() -> None: - project = tomllib.loads((ROOT / "pyproject.toml").read_text())["project"] - urls = project["urls"] - - assert project["name"] == "serpapi-hermes-plugin" - assert urls["Homepage"] == "https://github.com/serpapi/serpapi-hermes-plugin" - assert urls["Repository"] == "https://github.com/serpapi/serpapi-hermes-plugin" - assert urls["Issues"] == "https://github.com/serpapi/serpapi-hermes-plugin/issues" -def test_release_workflow_keeps_oidc_permission_in_publish_job() -> None: - workflow = (ROOT / ".github/workflows/release.yml").read_text() - publish_job = workflow.split("\n publish:\n", maxsplit=1)[1] - - assert "release:\n types: [published]" in workflow - assert workflow.count("id-token: write") == 1 - assert "needs: verify-distributions" in publish_job - assert "name: pypi" in publish_job - assert "id-token: write" in publish_job - assert "pypa/gh-action-pypi-publish@" in publish_job - assert "actions/checkout@" not in publish_job - assert "uv build" not in publish_job - assert "PYPI_API_TOKEN" not in workflow