mirror of
https://github.com/actions-rs/cargo.git
synced 2025-08-14 12:45:12 +00:00
As the cross requires recent enough Rust and cwd might be overriden to use old one toolchain, switching cwd temporary to install cross.
Rust cargo
Action
This GitHub Action runs specified cargo
command on a Rust language project.
Example workflow
on: [push]
name: CI
jobs:
build_and_test:
name: Rust project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/cargo@v1
with:
command: build
toolchain: nightly
arguments: --release --all-features
- uses: actions-rs/cargo@v1
with:
command: test
toolchain: nightly
arguments: --all-targets
Inputs
command
(required) - Cargo command to run (ex.check
orbuild
)toolchain
- Rust toolchain to use (without the+
sign, ex.nightly
)args
- Arguments for the cargo commanduse-cross
- Usecross
instead ofcargo
(default:false
)
Why?
Why is it needed when you can just do the -run: cargo build
step?
Because it can call cross instead of cargo
if needed. If cross
is not installed, it will be installed automatically on a first call.
In a future this Action might be available to install other cargo subcommands on demand too.
Languages
TypeScript
100%