Add Rust SDK (technical preview) #622
Workflow file for this run
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: "Codegen Check" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - 'scripts/codegen/**' | |
| - 'nodejs/src/generated/**' | |
| - 'nodejs/src/sdkProtocolVersion.ts' | |
| - 'nodejs/scripts/update-protocol-version.ts' | |
| - 'dotnet/src/Generated/**' | |
| - 'dotnet/src/SdkProtocolVersion.cs' | |
| - 'python/copilot/generated/**' | |
| - 'python/copilot/_sdk_protocol_version.py' | |
| - 'go/generated_*.go' | |
| - 'go/rpc/**' | |
| - 'go/sdk_protocol_version.go' | |
| - 'rust/src/generated/**' | |
| - 'rust/src/sdk_protocol_version.rs' | |
| - 'sdk-protocol-version.json' | |
| - '.github/workflows/codegen-check.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| check: | |
| name: "Verify generated files are up-to-date" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| # Rust generator runs `cargo fmt` on the output, so we need a toolchain with rustfmt. | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.94.0" | |
| components: rustfmt | |
| - name: Install nodejs SDK dependencies | |
| working-directory: ./nodejs | |
| run: npm ci | |
| - name: Install codegen dependencies | |
| working-directory: ./scripts/codegen | |
| run: npm ci | |
| - name: Run codegen | |
| working-directory: ./scripts/codegen | |
| run: npm run generate | |
| - name: Regenerate SDK protocol version constants | |
| working-directory: ./nodejs | |
| run: npm run update:protocol-version | |
| - name: Check for uncommitted changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "::error::Generated files are out of date. Run 'cd scripts/codegen && npm run generate' and 'cd nodejs && npm run update:protocol-version', then commit the changes." | |
| git diff --stat | |
| git diff | |
| exit 1 | |
| fi | |
| echo "✅ Generated files are up-to-date" |