Go SDK #32
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: Go SDK | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'sdk/go/**' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - '.github/workflows/sdk-go.yml' | |
| pull_request: | |
| branches: [ main, develop ] | |
| paths: | |
| - 'sdk/go/**' | |
| - 'go.mod' | |
| - 'go.sum' | |
| - '.github/workflows/sdk-go.yml' | |
| schedule: | |
| - cron: '0 2 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-and-test: | |
| name: Go SDK Build & Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Build | |
| run: make sdk-go-build | |
| - name: Test | |
| run: make sdk-go-test | |
| check-drift: | |
| name: Check Generated Code Drift | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| # Only run drift check when openapi.json changes | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Set up Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install ogen | |
| run: go install github.com/ogen-go/ogen/cmd/ogen@v1.19.0 | |
| - name: Regenerate SDK | |
| run: make sdk-go-generate | |
| - name: Check for drift | |
| run: | | |
| if ! git diff --exit-code sdk/go/; then | |
| echo "Generated Go SDK code is out of sync with openapi.json." | |
| echo "Run 'make sdk-go-generate' and commit the result." | |
| exit 1 | |
| fi |