Skip to content

Commit 393d158

Browse files
tclemCopilot
andcommitted
ci: validate embedded-cli bundle build on macOS / Linux / Windows
The default `cargo test` job in rust-sdk-tests.yml runs on all three supported platforms but does not set `COPILOT_CLI_VERSION` — which means `build.rs` short-circuits immediately and the embedded-cli bundle path (download + SHA-256 verify + extract + zstd compress + embed) is never exercised in CI. After the recent switch from shelling out to `curl` over to `ureq` with retry logic in `build.rs`, that gap matters: the new HTTP client + cross-platform TLS code path needs cross-platform CI coverage before it ships. Adds a parallel `bundle` job to the same workflow: - 3-OS matrix: ubuntu-latest, macos-latest, windows-latest. - Reads the pinned CLI version from `nodejs/package.json` so the bundle test always tracks the same version the rest of the SDK ships against — no separate version source to drift. - Caches the downloaded archive in `./rust/.bundled-cli-cache` keyed on OS + CLI version, so steady-state CI doesn't refetch ~130 MB on every run. Cache miss (e.g. first run after a CLI bump) exercises the full download path end-to-end, which is the regression surface this job is meant to catch. - Runs `cargo build --features embedded-cli` to drive `build.rs` through the full pipeline. Doesn't run `cargo test` — the test job already covers runtime behavior; this job is specifically validating the bundle build. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7a5f57e commit 393d158

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/rust-sdk-tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,61 @@ jobs:
110110
package: github-copilot-sdk
111111
manifest-path: rust/Cargo.toml
112112

113+
# Validates the `embedded-cli` build path on all three supported
114+
# platforms. This is the only place `build.rs` actually runs (the
115+
# default `cargo test` job above has `COPILOT_CLI_VERSION` unset, so
116+
# `build.rs` returns immediately). Catches regressions in the
117+
# download / verify / extract / embed pipeline before they ship to
118+
# crates.io and before bundling consumers (e.g. github-app's
119+
# bundled-CLI release pipeline) hit them downstream.
120+
bundle:
121+
name: "Rust SDK Bundled CLI Build"
122+
env:
123+
CARGO_TERM_COLOR: always
124+
RUST_BACKTRACE: 1
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
os: [ubuntu-latest, macos-latest, windows-latest]
129+
runs-on: ${{ matrix.os }}
130+
defaults:
131+
run:
132+
shell: bash
133+
working-directory: ./rust
134+
steps:
135+
- uses: actions/checkout@v6.0.2
136+
137+
- name: Install Rust toolchain
138+
uses: dtolnay/rust-toolchain@stable
139+
with:
140+
toolchain: "1.94.0"
141+
142+
- uses: Swatinem/rust-cache@v2
143+
with:
144+
workspaces: "rust"
145+
key: bundled-cli
146+
147+
- name: Read pinned @github/copilot CLI version
148+
id: cli-version
149+
working-directory: ./nodejs
150+
run: |
151+
version=$(node -p "require('./package.json').dependencies['@github/copilot'].replace(/^[\^~]/, '')")
152+
echo "version=$version" >> "$GITHUB_OUTPUT"
153+
echo "Pinned CLI version: $version"
154+
155+
# Cache the downloaded archive across runs so we don't refetch
156+
# ~130 MB on every CI invocation. Keyed by OS + CLI version; on
157+
# cache miss the bundle job exercises the full ureq download +
158+
# SHA-256 + retry path, which is exactly the regression surface
159+
# we want validated.
160+
- name: Cache bundled CLI tarball
161+
uses: actions/cache@v4
162+
with:
163+
path: ./rust/.bundled-cli-cache
164+
key: bundled-cli-${{ matrix.os }}-${{ steps.cli-version.outputs.version }}
165+
166+
- name: cargo build --features embedded-cli
167+
env:
168+
COPILOT_CLI_VERSION: ${{ steps.cli-version.outputs.version }}
169+
BUNDLED_CLI_CACHE_DIR: ${{ github.workspace }}/rust/.bundled-cli-cache
170+
run: cargo build --features embedded-cli

0 commit comments

Comments
 (0)