SDK: Align canvas with codegen pipeline, add e2e tests #674
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: "Rust SDK Tests" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| paths: | |
| - 'rust/**' | |
| - 'test/**' | |
| - 'nodejs/package.json' | |
| - '.github/workflows/rust-sdk-tests.yml' | |
| - '.github/actions/setup-copilot/**' | |
| - '!**/*.md' | |
| - '!**/LICENSE*' | |
| - '!**/.gitignore' | |
| - '!**/.editorconfig' | |
| - '!**/*.png' | |
| - '!**/*.jpg' | |
| - '!**/*.jpeg' | |
| - '!**/*.gif' | |
| - '!**/*.svg' | |
| workflow_dispatch: | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: "Rust SDK Tests" | |
| if: github.event.repository.fork == false | |
| env: | |
| POWERSHELL_UPDATECHECK: Off | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ./rust | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: ./.github/actions/setup-copilot | |
| id: setup-copilot | |
| # rust-toolchain.toml in rust/ pins the stable channel + components. | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.94.0" | |
| components: rustfmt, clippy | |
| # Nightly rustfmt for unstable format options (group_imports, | |
| # imports_granularity, reorder_impl_items) — pinned in | |
| # `.rustfmt.nightly.toml`. | |
| - name: Install nightly rustfmt | |
| if: runner.os == 'Linux' | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: nightly-2026-04-14 | |
| components: rustfmt | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rust" | |
| prefix-key: v1-rust-no-bin | |
| cache-bin: false | |
| - name: cargo fmt --check (nightly) | |
| if: runner.os == 'Linux' | |
| run: cargo +nightly-2026-04-14 fmt --all -- --config-path .rustfmt.nightly.toml --check | |
| - name: cargo clippy | |
| if: runner.os == 'Linux' | |
| run: cargo clippy --all-targets --features test-support -- --no-deps -D warnings -D clippy::unwrap_used -D clippy::disallowed_macros -D clippy::await_holding_invalid_type | |
| - name: cargo doc | |
| if: runner.os == 'Linux' | |
| env: | |
| RUSTDOCFLAGS: "-D warnings" | |
| run: cargo doc --no-deps --all-features | |
| - name: Install test harness dependencies | |
| working-directory: ./test/harness | |
| run: npm ci --ignore-scripts | |
| - name: Warm up PowerShell | |
| if: runner.os == 'Windows' | |
| run: pwsh.exe -Command "Write-Host 'PowerShell ready'" | |
| - name: cargo test | |
| timeout-minutes: 90 | |
| env: | |
| RUST_E2E_CONCURRENCY: 4 | |
| COPILOT_HMAC_KEY: ${{ secrets.COPILOT_DEVELOPER_CLI_INTEGRATION_HMAC_KEY }} | |
| COPILOT_CLI_PATH: ${{ steps.setup-copilot.outputs.cli-path }} | |
| # `--no-default-features` disables the bundled-cli download; the | |
| # tests use the CLI provided by setup-copilot via COPILOT_CLI_PATH. | |
| # The dedicated `bundle` job below exercises the bundling pipeline. | |
| run: cargo test --no-default-features --features test-support -- --test-threads=4 --nocapture | |
| # Validates the bundled-CLI build path on all three supported | |
| # platforms. While the regular `cargo test` job above also exercises | |
| # build.rs (bundling is on by default now), this matrix job is the | |
| # dedicated cross-platform smoke test for the download / verify / | |
| # extract / embed pipeline. Catches regressions before they ship to | |
| # crates.io and before bundling consumers hit them downstream. | |
| bundle: | |
| name: "Rust SDK Bundled CLI Build" | |
| if: github.event.repository.fork == false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: ./rust | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: "1.94.0" | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "rust" | |
| key: bundled-cli | |
| prefix-key: v1-rust-no-bin | |
| cache-bin: false | |
| - name: Read pinned @github/copilot CLI version | |
| id: cli-version | |
| working-directory: ./nodejs | |
| run: | | |
| version=$(node -p "require('./package-lock.json').packages['node_modules/@github/copilot'].version") | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "Pinned CLI version: $version" | |
| # Cache the downloaded archive across runs so we don't refetch | |
| # ~130 MB on every CI invocation. Keyed by OS + CLI version so old | |
| # archives drop out when the pinned version bumps, keeping the | |
| # cache bounded. | |
| - name: Cache bundled CLI tarball | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./rust/.bundled-cli-cache | |
| key: bundled-cli-${{ matrix.os }}-${{ steps.cli-version.outputs.version }} | |
| - name: cargo build (bundled-cli is the default feature) | |
| env: | |
| BUNDLED_CLI_CACHE_DIR: ${{ github.workspace }}/rust/.bundled-cli-cache | |
| run: cargo build |