Skip to content

✨ feat(build): cargo-binstall support (#27)#173

Merged
kbrdn1 merged 3 commits into
devfrom
feat/#27-cargo-binstall
May 29, 2026
Merged

✨ feat(build): cargo-binstall support (#27)#173
kbrdn1 merged 3 commits into
devfrom
feat/#27-cargo-binstall

Conversation

@kbrdn1
Copy link
Copy Markdown
Owner

@kbrdn1 kbrdn1 commented May 29, 2026

What

Adds [package.metadata.binstall] to Cargo.toml so cargo binstall gwm pulls the prebuilt binary from the GitHub Release instead of compiling git2/vendored-libgit2 from source (closes #27).

[package.metadata.binstall]
pkg-url = "{ repo }/releases/download/v{ version }/gwm-v{ version }-{ target }.tar.gz"
pkg-fmt = "tgz"
bin-dir = "gwm-v{ version }-{ target }/{ bin }"

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/v{ version }/gwm-v{ version }-{ target }.zip"
pkg-fmt = "zip"

Why the extension is hardcoded (not { archive-format })

The issue's sketch used { archive-format }, but our release assets are named .tar.gz (not .tgz). Hardcoding .tar.gz / .zip in pkg-url guarantees the URL matches the real artefacts the workflow publishes; pkg-fmt still tells binstall how to extract. The Windows artefact is a .zip, so it gets its own pkg-url in the override.

Verified against the packaging steps in pre-release.yml / release.yml:

  • asset name: gwm-v{version}-{target}.{tar.gz|zip}
  • in-archive layout: gwm-v{version}-{target}/{gwm|gwm.exe}bin-dir = gwm-v{version}-{target}/{bin}

Tests (TDD)

tests/binstall_metadata_tests.rs parses the manifest and pins pkg-url, pkg-fmt, bin-dir, and the windows override against artefact-naming drift (adds toml as a dev-dependency for structural assertions, mirroring how homebrew_formula_tests.rs guards the tap template).

Docs

  • README install matrix → cargo binstall gwm row.
  • docs/1.getting-started/1.install.md → dedicated section.
  • CHANGELOG [Unreleased].

Local: cargo test green, cargo fmt --check, cargo clippy --all-targets -- -D warnings clean.

kbrdn1 added 2 commits May 29, 2026 11:34
Add `[package.metadata.binstall]` so `cargo binstall gwm` pulls the
prebuilt archive from the GitHub Release instead of compiling git2 /
vendored-libgit2 from source. `pkg-url` mirrors the release workflows'
artefact naming (`gwm-v{version}-{target}.tar.gz`), `bin-dir` mirrors
the in-archive layout (`gwm-v{version}-{target}/{bin}`), and an
x86_64-pc-windows-msvc override points at the `.zip` artefact.

Tested: tests/binstall_metadata_tests.rs parses the manifest and pins
pkg-url / pkg-fmt / bin-dir / windows override against drift (adds
`toml` as a dev-dependency for structural assertions).
README install matrix gains a `cargo binstall gwm` row; the getting-
started install doc gets a dedicated section explaining the no-compile
path; CHANGELOG [Unreleased] notes the feature.
Copilot AI review requested due to automatic review settings May 29, 2026 09:35
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds cargo-binstall support so users can install prebuilt gwm binaries from GitHub Releases without compiling git2/libgit2 from source. The new [package.metadata.binstall] block in Cargo.toml is pinned to the existing release artefact naming (gwm-v{version}-{target}.tar.gz, .zip for Windows MSVC) and is guarded by a new structural test, with matching README/install-doc/changelog updates.

Changes:

  • Add [package.metadata.binstall] (plus Windows .zip override) to Cargo.toml and a toml dev-dep.
  • Add tests/binstall_metadata_tests.rs pinning pkg-url, pkg-fmt, bin-dir, and the Windows override against artefact drift.
  • Document the new install channel in README.md, docs/1.getting-started/1.install.md, and CHANGELOG.md.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Declares binstall metadata + Windows override; adds toml = "1.1" dev-dependency for the new test.
tests/binstall_metadata_tests.rs Structurally asserts the binstall block matches the release workflow's artefact layout.
README.md Adds a cargo binstall gwm row to the install matrix with a one-line explainer.
docs/1.getting-started/1.install.md Dedicated section explaining cargo binstall gwm and the metadata contract.
CHANGELOG.md New Added entry under [Unreleased] for #27, replacing the placeholder line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kbrdn1 kbrdn1 merged commit 388763e into dev May 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants