Validate runtime token budgets #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| offline: | |
| name: Offline checks | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| # Edge-case checks are offline/mock/runtime-contract tests. These dummy values | |
| # only satisfy startup env validation; real external API/tool checks use | |
| # GitHub Secrets in the main-agent-api and workflow_dispatch jobs. | |
| env: | |
| API_KEY: ci-dummy | |
| API_BASE: http://127.0.0.1:9/v1 | |
| MODEL_NAME: gpt-5.5 | |
| SERPER_KEY: ci-dummy | |
| JINA_KEY: ci-dummy | |
| MINERU_TOKEN: ci-dummy | |
| PYTHONDONTWRITEBYTECODE: "1" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -e . --no-deps | |
| - name: Check package import | |
| run: python -c "import researchharness; print(researchharness.__version__)" | |
| - name: Compile Python sources | |
| run: python -m compileall agent_base api frontend researchharness run_agent.py run_frontend.py run_server.py | |
| - name: Run edge-case checks | |
| run: python tests/test_edge_case_checks.py | |
| - name: Run optional extra-tool checks | |
| run: python tests/test_extra_tools.py | |
| - name: Run Python import API checks | |
| run: python tests/test_python_api_tools.py | |
| main-agent-api: | |
| name: Main agent API smoke | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: offline | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: test_keys | |
| env: | |
| API_KEY: ${{ secrets.API_KEY }} | |
| API_BASE: ${{ secrets.API_BASE }} | |
| MODEL_NAME: ${{ secrets.MODEL_NAME }} | |
| SERPER_KEY: ${{ secrets.SERPER_KEY }} | |
| JINA_KEY: ${{ secrets.JINA_KEY }} | |
| MINERU_TOKEN: ${{ secrets.MINERU_TOKEN }} | |
| PYTHONDONTWRITEBYTECODE: "1" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Verify required secrets are configured | |
| run: | | |
| python - <<'PY' | |
| import os | |
| missing = [ | |
| name for name in ( | |
| "API_KEY", | |
| "API_BASE", | |
| "MODEL_NAME", | |
| "SERPER_KEY", | |
| "JINA_KEY", | |
| "MINERU_TOKEN", | |
| ) | |
| if not os.getenv(name) | |
| ] | |
| if missing: | |
| raise SystemExit("Missing required GitHub Actions secrets: " + ", ".join(missing)) | |
| print("Required secrets are configured.") | |
| PY | |
| - name: Run main agent real API smoke test | |
| run: python tests/test_tool_availability.py --only MainAgentAPI |