ci: regenerate from the committed spec so the drift check is hermetic #29
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: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v7 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| enable-cache: true | |
| - run: uv sync --locked --all-extras --dev | |
| # Hermetic: regenerates from the committed spec, so this verifies that the committed | |
| # generated code still reproduces from it, with no network dependency. Refreshing the | |
| # spec itself is the release workflow's job. | |
| - name: Codegen drift check | |
| if: matrix.python == '3.12' | |
| env: | |
| ROXYAPI_SPEC_FILE: specs/openapi.json | |
| run: | | |
| uv run python generate.py | |
| git diff --exit-code -- specs/openapi.json src/roxy_sdk/factory.py \ | |
| || { echo 'codegen drift: commit the regenerated files'; exit 1; } | |
| - name: Lint | |
| if: matrix.python == '3.12' | |
| run: uv run ruff check . | |
| - name: Typecheck | |
| if: matrix.python == '3.12' | |
| run: uv run mypy src/roxy_sdk/__init__.py | |
| - name: Test | |
| run: uv run pytest tests/test_factory.py -v |