Repository navigation
Generate the SDK with Ferrule #85
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: | |
| pull_request: | |
| workflow_dispatch: | |
| workflow_call: # the release workflow runs CI before publishing | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint and types | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 | |
| with: | |
| enable-cache: true | |
| - run: uv sync --locked | |
| - run: uv run ruff check . | |
| - run: uv run ruff format --check . | |
| - run: uv run pyright | |
| - run: uv run mypy | |
| - name: openapi.json and stainless.yml match spec/contract.json | |
| run: | | |
| uv run --no-project --python 3.12 python scripts/opencode/contract_to_openapi.py spec/contract.json openapi.json | |
| uv run --no-project --python 3.12 python scripts/opencode/config_models.py openapi.json stainless.yml | |
| git diff --exit-code -- openapi.json stainless.yml | |
| test: | |
| name: Test (Python ${{ matrix.python }}, ${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest] | |
| python: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| include: | |
| - os: macos-latest | |
| python: "3.13" | |
| - os: windows-latest | |
| python: "3.13" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 | |
| with: | |
| enable-cache: true | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: 22 | |
| - run: uv sync --locked | |
| - name: Start the mock server | |
| shell: bash | |
| run: ./scripts/mock --daemon | |
| # The generated tests run against the mock (pytest-asyncio); the hand-written ones in | |
| # tests/custom use anyio and trio, so they run apart. | |
| - run: uv run pytest --cov --cov-report=term-missing | |
| - run: >- | |
| uv run pytest --confcutdir=tests/custom -o asyncio_mode=strict -o addopts="-ra --strict-markers" | |
| -m "not live" --cov --cov-append --cov-report=term-missing tests/custom | |
| lowest: | |
| name: Test with lowest supported dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 | |
| with: | |
| python-version: "3.10" | |
| - run: >- | |
| uv run --isolated --resolution lowest-direct --with-editable '.[pty,aiohttp]' | |
| --with pytest --with pytest-asyncio --with respx --with trio --with dirty-equals --with time-machine | |
| pytest -p no:cacheprovider --ignore=tests/api_resources | |
| - run: >- | |
| uv run --isolated --resolution lowest-direct --with-editable '.[pty,aiohttp]' | |
| --with pytest --with pytest-asyncio --with respx --with trio | |
| pytest -p no:cacheprovider --confcutdir=tests/custom -o asyncio_mode=strict | |
| -o addopts="-ra --strict-markers" -m "not live" tests/custom | |
| live: | |
| name: Live server | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 | |
| with: | |
| enable-cache: true | |
| - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 | |
| with: | |
| node-version: 22 | |
| # The OpenCode version is pinned by hash in .github/live/package-lock.json. | |
| - run: npm ci --prefix .github/live | |
| - run: echo "$GITHUB_WORKSPACE/.github/live/node_modules/.bin" >> "$GITHUB_PATH" | |
| - run: opencode --version | |
| - run: uv sync --locked | |
| - run: >- | |
| uv run pytest --confcutdir=tests/custom -o asyncio_mode=strict -o addopts="-ra --strict-markers" | |
| -m live -v tests/custom | |
| build: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0 | |
| - run: uv build | |
| - run: uvx twine check --strict dist/* | |
| - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 | |
| with: | |
| name: dist | |
| path: dist/ | |
| fuzz: | |
| name: Fuzz SSE decoder | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0 | |
| with: | |
| python-version: "3.12" | |
| - run: uv sync --locked | |
| - run: uv run --with atheris python fuzz/fuzz_sse.py -max_total_time=60 |