Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed Sep 15, 2019
1 parent 0deeed3 commit eadeb9d
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 15 deletions.
51 changes: 39 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Rust `cargo` Action

![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)
[![Gitter](https://badges.gitter.im/actions-rs/community.svg)](https://gitter.im/actions-rs/community)

This GitHub Action runs specified [`cargo`](https://github.com/rust-lang/cargo)
Expand All @@ -21,27 +22,53 @@ jobs:
- 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` or `build`)
* `toolchain` - Rust toolchain to use (without the `+` sign, ex. `nightly`)
* `toolchain` - Rust toolchain to use (without the `+` sign, ex. `nightly`);\
Override or system toolchain will be used if omitted.
* `args` - Arguments for the cargo command
* `use-cross` - Use [`cross`](https://github.com/rust-embedded/cross) instead of `cargo` (default: `false`)

## Why?
## Virtual environments

Note that `cargo` is not available by default for all [virtual environments](https://help.github.com/en/articles/software-in-virtual-environments-for-github-actions);
for example, as for 2019-09-15, `macOS` env is missing it.

You can use [`actions-rs/toolchain`](https://github.com/actions-rs/toolchain)
to install the Rust toolchain with `cargo` included.

## Cross

Why is it needed when you can just do the `-run: cargo build` step?
In order to make cross-compilation an easy process,
this Action can install [cross](https://github.com/rust-embedded/cross)
tool on demand if `use-cross` input is enabled; `cross` executable will be invoked
then instead of `cargo` automatically.

All consequent calls of this Action in the same job will use the same `cross` installed.

```yaml
on: [push]
Because it can call [cross](https://github.com/rust-embedded/cross) instead of `cargo`
if needed. If `cross` is not installed, it will be installed automatically on a first call.
name: ARMv7 build
In a future this Action might be available to install other cargo subcommands on demand too.
jobs:
linux_arm7:
name: Linux ARMv7
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target armv7-unknown-linux-gnueabihf
```
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'cargo'
name: 'rust-cargo'
description: 'Run cargo command'
author: 'actions-rs team'
branding:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cargo",
"version": "0.1.0",
"name": "rust-cargo",
"version": "1.0.0",
"private": false,
"description": "Run cargo command",
"main": "lib/main.js",
Expand Down

0 comments on commit eadeb9d

Please sign in to comment.