ci: regenerate from the committed spec so the drift check is hermetic #14
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: | |
| checks: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: stable | |
| # 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 | |
| env: | |
| ROXYAPI_SPEC_FILE: specs/openapi.json | |
| run: | | |
| go run ./tools/roxygen generate | |
| git diff --exit-code -- specs/openapi.json roxyapi.gen.go roxy.gen.go \ | |
| || { echo 'codegen drift: run "go run ./tools/roxygen generate" and commit the result'; exit 1; } | |
| - name: Docs drift check | |
| run: | | |
| go run ./tools/roxygen sync-docs | |
| git diff --exit-code -- README.md AGENTS.md docs/llms-full.txt \ | |
| || { echo 'docs drift: run "go run ./tools/roxygen sync-docs" and commit the result'; exit 1; } | |
| - name: gofmt | |
| run: test -z "$(gofmt -l .)" || { echo 'run gofmt -w .'; gofmt -l .; exit 1; } | |
| - name: Vet | |
| run: go vet ./... | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| go: ['1.24.x', 'stable'] | |
| env: | |
| GOWORK: off | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version: ${{ matrix.go }} | |
| - name: Build | |
| run: go build . | |
| - name: Test | |
| run: go test . | |
| env: | |
| ROXY_API_KEY: ${{ secrets.ROXY_API_KEY }} |