Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
box

GitHub Action

cargo action

v0.0.3

cargo action

box

cargo action

Invoke cargo/cross and commands

Installation

Copy and paste the following snippet into your .yml file.

              

- name: cargo action

uses: ClementTsang/[email protected]

Learn more about this action in ClementTsang/cargo-action

Choose a version

cargo-action

A simple GitHub Action to invoke cargo/cross and commands. Inputs and usage inspired by action-rs' cargo action, with dtolnay's rust-toolchain as reference.

Written for use in personal projects, though feel free to use it on your own. Big fat disclaimer though that it may or may not work for your use case - if that's the case, I'm open to issue reports and PRs.

Inputs

Note: Inputs aren't necessarily checked to be valid!

Name Description
command The cargo command to run (e.g. build, test). Required.
toolchain The toolchain to use. Do not include the + sign (e.g. nightly, beta). Defaults to stable.
args What arguments to pass to the cargo/cross command.
use-cross Whether to use cross instead of using cargo. If enabled, cross will automatically be installed if needed.
cross-version The cross version to use. Only used if use-cross is enabled. If not set, defaults to the newest stable version of cross.
directory Change to the specified directory prior to execution. Useful if your repo's base folder does not contain your Rust project.

Example

name: Test
on: push

jobs:
  test:
  runs-on: ubuntu-latest
  steps:
    - uses: actions/checkout@v3
    - uses: dtolnay/rust-toolchain@stable
    - uses: ClementTsang/[email protected]
      with:
        command: test
        args: --lib --bins --benches
        use-cross: true
        cross-version: 0.2.4