init: pipeline + workflows #1
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: Test | |
| on: | |
| pull_request: | |
| paths: | |
| - "python/**" | |
| - "openapi.json" | |
| - ".github/workflows/test.yaml" | |
| push: | |
| branches: [main] | |
| paths: | |
| - "python/**" | |
| - "openapi.json" | |
| - ".github/workflows/test.yaml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| unit: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SDK + dev deps | |
| working-directory: python | |
| run: | | |
| python3 -m venv /tmp/sdk-venv | |
| /tmp/sdk-venv/bin/pip install --quiet -e ./. "pytest>=8,<9" "python-dotenv>=1,<2" | |
| - name: Smoke import | |
| run: | | |
| /tmp/sdk-venv/bin/python -c "from agent_platform import Client, AsyncClient; Client(api_key='hk-smoke', base_url='http://x'); print('SDK install + import OK')" | |
| - name: Unit tests (model round-trip + structural) | |
| working-directory: python | |
| run: /tmp/sdk-venv/bin/pytest tests/ -m "not integration" -v | |
| - name: Collect integration tests (catches stale imports without hitting the API) | |
| working-directory: python | |
| run: /tmp/sdk-venv/bin/pytest tests/integration --collect-only -m integration -q | |
| integration-live: | |
| # Hits the live prod backend with HAI_API_KEY_TEST. Only runs when the secret | |
| # is configured (forks / contributors without secrets skip this safely). | |
| # Tests are namespaced (sdkit-<ts>-<hex>) so artefacts on failure are easy to spot. | |
| if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| needs: unit | |
| env: | |
| HAI_API_KEY_TEST: ${{ secrets.HAI_API_KEY_TEST }} | |
| HAI_API_BASE_URL_TEST: "https://agp.hcompany.ai" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install SDK + dev deps | |
| working-directory: python | |
| run: | | |
| python3 -m venv /tmp/sdk-venv | |
| /tmp/sdk-venv/bin/pip install --quiet \ | |
| --index-url https://pypi.org/simple \ | |
| -e ./. "pytest>=8,<9" "python-dotenv>=1,<2" | |
| - name: Run fast integration tier | |
| if: env.HAI_API_KEY_TEST != '' | |
| working-directory: python | |
| run: /tmp/sdk-venv/bin/pytest tests/integration -m "integration and not slow" -v --tb=short |