cargo search, built for caching binary artifacts, optimized for GitHub Actions

Overview

cargo-search2

cargo-search2 on crates.io Documentation (latest release) Documentation (main) License License

A binary utility that provides a more convenient version of cargo search.

Installation

Grab pre-built binaries for your platform from the releases page.

To grab releases in CI or other automation:

curl -LsSf https://github.com/sunshowers/cargo-search2/releases/latest/download/cargo-search2-{platform}.zip | tar xzf - -C ~/.cargo/bin

Install manually:

cargo install cargo-search2

Examples

$ cargo search2 serde
# output:
serde 1.0.130 (hash: blake2b24:2e6117acae4f6f2d2d698c9fc0b43de60ac26556f44ad96b)

$ cargo search2 serde --message-format toml
serde = "1.0.130"

$ cargo search2 serde --message-format json
{"crate-name":"serde","version":"1.0.130","hash":"blake2b24:2e6117acae4f6f2d2d698c9fc0b43de60ac26556f44ad96b"}

# Get an exact version or semver range
$ cargo search2 serde --req '=1.0.120'
serde 1.0.120 (hash: blake2b24:f79131f50c298569f841e47287c3b0a443c29cfda3ffd475)

# Use --cache-version/-c to invalidate caches
$ cargo run -- serde --req '=1.0.120' -c1
serde 1.0.120 (hash: blake2b24:168778241e3b0e96f5547fba1eb4b4b84efa8291c3c14b37)
$ cargo run -- serde --req '=1.0.120' -c2
serde 1.0.120 (hash: blake2b24:344d8a8d08a16dbce8c4e0d90fd6aad513631ca081185ea8)

# Step outputs for GitHub Actions
$ cargo search2 serde --message-format github
::set-output name=crate-name::serde
::set-output name=version::1.0.120
::set-output name=hash::blake2b24:f79131f50c298569f841e47287c3b0a443c29cfda3ffd475

For an example GitHub Action, see .github/workflows/example.yml.

Why?

People sometimes use cargo search to generate cache keys for tools. This is an easier way to achieve the same goal with a couple more features.

cargo search2 supports:

  • looking for exact versions and semver ranges
  • producing results in plain, JSON, and GitHub Actions formats
  • easy cache invalidation through the --cache-version option

Hash contents

The hashes produced by cargo search2 are derived from:

  • The name of the crate
  • The exact version number
  • The cache version

Notably, the operating system and other parts of the environment are not part of the hash.

Stability guarantees

Within a semver range, the command-line interface is append-only, and hashes stay the same.

Contributing

Pull requests are welcome! Please follow the code of conduct.

License

This project is available under the terms of either the Apache 2.0 license or the MIT license.

You might also like...
A working example of multi targets compilation for Rust using Github Actions.

A working example of multi targets compilation for Rust using Github Actions. Supports Windows, MacOSX, x86_64, ARM and Raspberry PI Linux.

runs init, preview and apply on pulumi stacks right in your Github Actions. Inspired from Atalantis for Terraform

pulumi-actions runs init, preview and apply on pulumi stacks right in your Github-Actions. Inspired from Atlantis for Terraform PREVIEW Release Curren

A buildpack for Rust applications on Heroku, with full support for Rustup, cargo and build caching.

Heroku buildpack for Rust This is a Heroku buildpack for Rust with support for cargo and rustup. Features include: Caching of builds between deploymen

Punic is a remote caching CLI built for Apple's .xcframework
Punic is a remote caching CLI built for Apple's .xcframework

Punic is a remote caching CLI built for Carthage that exclusively supports Apple's .xcframeworks.

"putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely.

Putzen "putzen" is German and means cleaning. It helps keeping your disk clean of build and dependency artifacts safely. About In short, putzen solves

Hide memory artifacts using ROP and hardware breakpoints.
Hide memory artifacts using ROP and hardware breakpoints.

Description This tool is a simple PoC of how to hide memory artifacts using a ROP chain in combination with hardware breakpoints. The ROP chain will c

Dead simple, memoized cargo subcommand to hoist cargo-built binaries into the current working directory, written in Rust.
Dead simple, memoized cargo subcommand to hoist cargo-built binaries into the current working directory, written in Rust.

cargo-hoist Dead simple cargo subcommand to hoist cargo-built binaries into scope. stable Install | User Docs | Crate Docs | Reference | Contributing

 Software for managing Stream Deck devices with folders and actions
Software for managing Stream Deck devices with folders and actions

Streamduck Software for managing Stream Deck devices with folders and actions Project that will perhaps be better than streamdeck-ui Currently still i

bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner.
bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner.

Bevy Sequential Actions bevy_sequential_actions is a library for the Bevy game engine that aims to execute a list of actions in a sequential manner. T

🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀
🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀

Backpack A tool to curate and automate your starter projects Key Features • How To Use • Download • Contributing • License Key Features Generate from

Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. 💡 Looking for an async version? async-std https://github.c

Discover GitHub token scope permission and return you an easy interface for checking token permission before querying GitHub.

github-scopes-rs Discover GitHub token scope permission and return you an easy interface for checking token permission before querying GitHub. In many

Hitbox is an asynchronous caching framework supporting multiple backends and suitable for distributed and for single-machine applications.

Hitbox is an asynchronous caching framework supporting multiple backends and suitable for distributed and for single-machine applications.

Scalable and encrypted embedded database with 3-tier caching

Infinitree is a versioned, embedded database that uses uniform, encrypted blobs to store data.

Solana JSON-RPC caching server

Solana JSON-RPC caching server Disclaimer: This project is an early stage Work-In-Progress and is not ready for production use. This cache server impl

Attribute-Level Caching in Heterogeneous In-Memory DBMS

Alchemy Attribute-Level Caching in Heterogeneous In-Memory DBMS Alchemy is a DRAM-PM hybrid database engine built from scratch to achieve high perform

Web3-proxy: a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers.

web3-proxy Web3-proxy is a fast caching and load balancing proxy for web3 (Ethereum or similar) JsonRPC servers. Signed transactions (eth_sendRawTrans

ReadySet is a lightweight SQL caching engine written in Rust that helps developers enhance the performance and scalability of existing applications.
ReadySet is a lightweight SQL caching engine written in Rust that helps developers enhance the performance and scalability of existing applications.

ReadySet is a SQL caching engine designed to help developers enhance the performance and scalability of their existing database-backed applications. W

A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.)

FS Dir Cache A CLI tool for CIs and build scripts, making file system based caching easy and correct (locking, eviction, etc.) When working on build s

Releases(0.2.2)
Owner
Rain
they/she
Rain
Solana JSON-RPC caching server

Solana JSON-RPC caching server Disclaimer: This project is an early stage Work-In-Progress and is not ready for production use. This cache server impl

ZUBR 61 Dec 16, 2022
Attribute-Level Caching in Heterogeneous In-Memory DBMS

Alchemy Attribute-Level Caching in Heterogeneous In-Memory DBMS Alchemy is a DRAM-PM hybrid database engine built from scratch to achieve high perform

Xiangpeng Hao 14 Jun 20, 2022
Read-optimized cache of Cardano on-chain entities

Read-optimized cache of Cardano on-chain entities Intro Scrolls is a tool for building and maintaining read-optimized collections of Cardano's on-chai

TxPipe 58 Dec 2, 2022
Rust binary memcached implementation

bmemcached-rs Rust binary memcached implementation (ON GOING) Usage extern crate bmemcached; use std::sync::Arc; use std::thread; use bmemcached::Me

Jayson Reis 25 Jun 15, 2022
Cargo extension to recycle outdated build artifacts

cargo gc Cargo extension to recycle outdated build artifacts. And try the best to avoid recompilation. Usage Install it with cargo: cargo install carg

Ruihang Xia 23 Aug 30, 2023
Habitat is open source software that creates platform-independent build artifacts and provides built-in deployment and management capabilities.

Habitat is open source software that creates platform-independent build artifacts and provides built-in deployment and management capabilities. The go

Habitat 2.4k Dec 27, 2022
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
GitHub Actions for mdBook (rust-lang/mdBook) ⚡️ Setup mdBook quickly and build your site fast. Linux (Ubuntu), macOS, and Windows are supported.

GitHub Actions for mdBook rust-lang/mdBook Setup Action. We can run mdBook on a virtual machine of GitHub Actions by this mdBook action. Linux, macOS,

Shohei Ueda 231 Jan 2, 2023
A Github Actions based CI release template for Rust binaries

Rust CI Release Template A Github Actions based CI release template. This repo serves as a live template, and reference for building your own CI power

null 60 Dec 9, 2022
Run Github Actions workflows locally or on a custom backend

gha-runner runs Github Actions workflows. You can run workflows locally, or extend gha-runner with custom backends to run workflows elsewhere (e.g. Pe

Pernosco 12 Dec 27, 2022