Skip to content

Commit edb1920

Browse files
Split Rust CLI bundling by transport
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: da0a9335-969e-4a77-838a-daac9206a454
1 parent 4d480b4 commit edb1920

12 files changed

Lines changed: 1668 additions & 764 deletions

.github/workflows/publish.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,17 @@ jobs:
171171
- name: Set version
172172
run: sed -i -E 's/^version = ".*"$/version = "${{ needs.version.outputs.version }}"/' Cargo.toml
173173
- name: Snapshot CLI version + hashes for build.rs
174-
run: bash scripts/snapshot-bundled-cli-version.sh
175-
- name: Verify cli-version.txt exists
176174
run: |
177-
if [[ ! -f cli-version.txt ]]; then
178-
echo "::error::cli-version.txt was not generated. The Snapshot step must run before packaging."
179-
exit 1
180-
fi
175+
bash scripts/snapshot-bundled-cli-version.sh
176+
bash scripts/snapshot-bundled-in-process-version.sh
177+
- name: Verify CLI version snapshots exist
178+
run: |
179+
for snapshot in cli-version.txt cli-version-in-process.txt; do
180+
if [[ ! -f "${snapshot}" ]]; then
181+
echo "::error::${snapshot} was not generated. The Snapshot step must run before packaging."
182+
exit 1
183+
fi
184+
done
181185
- name: Package (dry run)
182186
run: cargo publish --dry-run --allow-dirty
183187
- name: Upload artifact

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ jobs:
8484
# Share the bundled-CLI archive cache with the `bundle` job: build.rs
8585
# now downloads in both modes (embed for `bundle`, extract-to-cache
8686
# for this `test` job's `--no-default-features` build).
87-
- name: Cache bundled CLI tarball
87+
- name: Cache bundled CLI archives
8888
uses: actions/cache@v4
8989
with:
9090
path: ./rust/.bundled-cli-cache
@@ -179,7 +179,7 @@ jobs:
179179
echo "version=$version" >> "$GITHUB_OUTPUT"
180180
echo "Pinned CLI version: $version"
181181
182-
- name: Cache bundled CLI tarball
182+
- name: Cache bundled CLI archives
183183
uses: actions/cache@v4
184184
with:
185185
path: ./rust/.bundled-cli-cache
@@ -258,15 +258,15 @@ jobs:
258258
# ~130 MB on every CI invocation. Keyed by OS + CLI version so old
259259
# archives drop out when the pinned version bumps, keeping the
260260
# cache bounded.
261-
- name: Cache bundled CLI tarball
261+
- name: Cache bundled CLI archives
262262
uses: actions/cache@v4
263263
with:
264264
path: ./rust/.bundled-cli-cache
265265
key: bundled-cli-${{ matrix.os }}-${{ steps.cli-version.outputs.version }}
266266

267-
- name: Test minimal bundled CLI archive
267+
- name: Test bundled CLI build paths
268268
env:
269269
BUNDLED_CLI_CACHE_DIR: ${{ github.workspace }}/rust/.bundled-cli-cache
270270
run: |
271-
cargo test --lib embedded_archive_contains_only_expected_files
271+
cargo build
272272
cargo test --features bundled-in-process --lib embedded_archive_contains_only_expected_files

rust/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/target
22
Cargo.lock.bak
33
cli-version.txt
4+
cli-version-in-process.txt

rust/Cargo.lock

Lines changed: 79 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@ readme = "README.md"
1313
license = "MIT"
1414
include = [
1515
"src/**/*",
16+
"build/**/*",
1617
"examples/**/*",
1718
"tests/**/*",
1819
"build.rs",
1920
"Cargo.toml",
2021
"README.md",
2122
"LICENSE",
2223
"cli-version.txt",
24+
"cli-version-in-process.txt",
2325
]
2426

2527
[lib]
2628
name = "github_copilot_sdk"
2729

2830
[features]
2931
default = ["bundled-cli"]
30-
bundled-cli = ["dep:tar", "dep:flate2"]
32+
bundled-cli = ["dep:tar", "dep:flate2", "dep:zip"]
3133
bundled-in-process = ["bundled-cli", "dep:libloading"]
3234
derive = ["dep:schemars"]
3335
test-support = []
@@ -66,6 +68,9 @@ futures-util = "0.3"
6668
reqwest = { version = "0.12", default-features = false, features = ["stream", "http2", "default-tls"] }
6769
tokio-tungstenite = { version = "0.24", default-features = false, features = ["connect", "native-tls"] }
6870

71+
[target.'cfg(windows)'.dependencies]
72+
zip = { version = "2", default-features = false, features = ["deflate"], optional = true }
73+
6974
[dev-dependencies]
7075
rusqlite = { version = "0.35", features = ["bundled"] }
7176
schemars = "1"
@@ -93,3 +98,4 @@ serde_json = "1"
9398
sha2 = "0.10"
9499
tar = "0.4"
95100
ureq = { version = "2", default-features = false, features = ["tls"] }
101+
zip = { version = "2", default-features = false, features = ["deflate"] }

0 commit comments

Comments
 (0)