Home

Awesome

cache-cargo-install-action

release github actions

GitHub Action for cargo install with cache.

This installs the specified crate using cargo install and caches the installed binaries using actions/cache. If binaries for the specified crate are already cached, restore the cache instead of calling cargo install.

This was originally intended for installing crates that are not supported by install-action. For performance and robustness, we recommend using install-action if the tool is supported by install-action.

Usage

Inputs

NameRequiredDescriptionTypeDefault
tooltrueCrate to installString
lockedfalseUse --locked flagBooleantrue
gitfalseInstall from the specified Git URL (see action.yml for more)String
tagfalseTag to use when installing from gitString
revfalseSpecific commit to use when installing from gitString

Example workflow

To install the latest version:

- uses: taiki-e/cache-cargo-install-action@v2
  with:
    tool: cargo-hack

To install a specific version, use @version syntax:

- uses: taiki-e/cache-cargo-install-action@v2
  with:
    tool: cargo-hack@0.5.24

You can also omit patch version. (You can also omit the minor version if the major version is 1 or greater.)

- uses: taiki-e/cache-cargo-install-action@v2
  with:
    tool: cargo-hack@0.5

Migrate from/to install-action

This action provides an interface compatible with install-action.

Therefore, migrating from/to install-action is usually just a change of action to be used. (if the tool and version are supported by install-action or install-action's binstall fallback)

To migrate from this action to install-action:

- - uses: taiki-e/cache-cargo-install-action@v2
+ - uses: taiki-e/install-action@v2
    with:
      tool: cargo-hack

To migrate from install-action to this action:

- - uses: taiki-e/install-action@v2
+ - uses: taiki-e/cache-cargo-install-action@v2
    with:
      tool: cargo-hack

The interface of this action is a subset of the interface of install-action, so note the following limitations when migrating from install-action to this action.

Compatibility

This action has been tested for GitHub-hosted runners (Ubuntu, macOS, Windows) and containers (Ubuntu, Debian, Fedora, Alma, Arch, Alpine). To use this action in self-hosted runners or in containers, at least the following tools are required:

Related Projects

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.