Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dist: add cargo metadata for cargo-binstall #653

Merged
merged 4 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
do_not_skip: '["pull_request"]'

build:
name: build (${{ matrix.target2 }})
name: build (${{ matrix.os }} native + ${{ matrix.target2 }})
needs: skip-check
if: ${{ needs.skip-check.outputs.should_skip != 'true' }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -60,6 +60,17 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target2 }}
- name: Setup cargo-binstall
if: matrix.os != 'windows-latest' #HACK: Work around https://github.com/cargo-bins/cargo-binstall/issues/1080.
uses: cargo-bins/cargo-binstall@main
- name: Test installation via cargo-binstall (${{ matrix.os }} native)
if: matrix.os != 'windows-latest' #HACK: Work around https://github.com/cargo-bins/cargo-binstall/issues/1080.
run: |
cargo binstall pacaptr --manifest-path=./Cargo.toml --dry-run --strategies=crate-meta-data --log-level=debug
- name: Test installation via cargo-binstall (${{ matrix.target2 }})
if: matrix.os != 'windows-latest' #HACK: Work around https://github.com/cargo-bins/cargo-binstall/issues/1080.
run: |
cargo binstall pacaptr --manifest-path=./Cargo.toml --dry-run --strategies=crate-meta-data --log-level=debug --targets=${{ matrix.target2 }}
- name: Build
if: ${{ steps.cache_build.outputs.cache-hit != 'true' }}
run: |
Expand Down
11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ include = ["LICENSE", "Cargo.toml", "src/**/*.rs", "build.rs"]
[package.metadata.docs.rs]
all-features = true

[package.metadata.binstall]
bin-dir = "{ bin }{ binary-ext }"

[package.metadata.binstall.overrides]
x86_64-apple-darwin.pkg-url = "{ repo }/releases/download/v{ version }/{ name }-darwin-universal2{ archive-suffix }"
aarch64-apple-darwin.pkg-url = "{ repo }/releases/download/v{ version }/{ name }-darwin-universal2{ archive-suffix }"
x86_64-pc-windows-msvc = { pkg-url = "{ repo }/releases/download/v{ version }/{ name }-windows-amd64{ archive-suffix }", pkg-fmt = "zip" }
aarch64-pc-windows-msvc = { pkg-url = "{ repo }/releases/download/v{ version }/{ name }-windows-arm64{ archive-suffix }", pkg-fmt = "zip" }
x86_64-unknown-linux-musl.pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-amd64{ archive-suffix }"
aarch64-unknown-linux-musl.pkg-url = "{ repo }/releases/download/v{ version }/{ name }-linux-arm64{ archive-suffix }"

[package.metadata.deb]
copyright = "2020, Rami3L"
maintainer = "Rami3L <[email protected]>"
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Please refer to the [compatibility table] for more details on which operations a

## Installation

> 💡 [We need your help](https://github.com/rami3l/pacaptr/issues/5) to achieve binary distribution of `pacaptr` on more platforms!
> **Note** > [We need your help](https://github.com/rami3l/pacaptr/issues/5) to achieve binary distribution of `pacaptr` on more platforms!

### Brew

Expand Down Expand Up @@ -113,19 +113,25 @@ choco install pacaptr
[![Cargo Version](https://img.shields.io/crates/v/pacaptr?style=flat-square)](https://crates.io/crates/pacaptr)
[![Cargo Downloads](https://img.shields.io/crates/d/pacaptr?style=flat-square)](https://crates.io/crates/pacaptr)

To install the release version from crates.io:
If you have installed [`cargo-binstall`], the fastest way of installing `pacaptr` via `cargo` is by running:

```bash
cargo binstall pacaptr
```

To build and install the release version from crates.io:

```bash
cargo install pacaptr
```

Alternatively, to install the `master` version from GitHub:
To build and install the `master` version from GitHub:

```bash
cargo install pacaptr --git https://github.com/rami3l/pacaptr.git
```

To clone and install (for the interested Rustaceans):
For those who are interested, it is also possible to build and install from your local repo:

```bash
git clone https://github.com/rami3l/pacaptr.git && cd pacaptr
Expand Down Expand Up @@ -308,8 +314,9 @@ This option is useful when you want to reduce `Docker` image size, for example.

Sounds nice! Please let me take you to the [contributing guidelines](docs/CONTRIBUTING.md) :)

[pacman rosetta]: https://wiki.archlinux.org/index.php/Pacman/Rosetta
[icy/pacapt]: https://github.com/icy/pacapt
[gsudo]: https://github.com/gerardog/gsudo
[`cargo-binstall`]: https://github.com/cargo-bins/cargo-binstall
[compatibility table]: https://rami3l.github.io/pacaptr/pacaptr/#compatibility-table
[gsudo]: https://github.com/gerardog/gsudo
[icy/pacapt]: https://github.com/icy/pacapt
[pacman rosetta]: https://wiki.archlinux.org/index.php/Pacman/Rosetta
[procursus]: https://github.com/ProcursusTeam/Procursus