ststefa / cargo-action

A simple GitHub Action to invoke cargo and subcommands.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 (i.e. bottom), 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/cargo-action@v0.0.2
      with:
        command: test
        args: --lib --bins --benches
        use-cross: true
        cross-version: 0.2.4

About

A simple GitHub Action to invoke cargo and subcommands.

License:MIT License


Languages

Language:Rust 100.0%