Git Product home page Git Product logo

github_action-rust's Introduction

Rust GitHub Action

Cross-platform composite GitHub Action for Rust Workflows

Usage Examples

Check the .github/workflows directory for usage examples.

Inputs

Input Description Required? Default Examples
subcommand The subcommand to use with cargo or cross Yes check fmt, clippy, check, test, doc, build, run
arguments The arguments to use with the subcommand No --workspace --all-features --bin binary_name -- --help -- -V
rust_release_channel The official Rust release channel to use No stable stable, beta, nightly
use_cross Whether to use cross instead of using cargo No false true, false
compilation_target The Rust compilation target to use No x86_64-unknown-linux-gnu x86_64-unknown-linux-gnu, x86_64-pc-windows-msvc, aarch64-apple-darwin
working_directory The directory to run the commands in No . ., ./tests/test_app, ./rust_project_workspace

Steps

Below are the steps that this GitHub action undertakes:

1. Checkout Git Repository

Checks out the target git repository in the runner container. Uses actions/checkout

2. Determine Rust Toolchain components

Selects the Rust toolchain components to install based on the provided subcommand. If one of the supported subcommands (see examples above) is not provided, the following components are installed.

3. Install Rust Toolchain

Installs the Rust toolchain based on the provided information about the release channel, the compilation target, and the toolchain components. Uses dtolnay/rust-toolchain.

4. Install Cross-Compilation Tools

Installs cross-rs. Uses taiki-e/install-action.

5. Install llvm-cov

Installs cargo-llvm-cov(https://github.com/taiki-e/cargo-llvm-cov) if necessary. Uses taiki-e/install-action.

6. Setup Cache

Sets up Rust cache. Uses Swatinem/rust-cache

7. Cargo Command

Runs the given subcommand using cargo and the provided arguments, if the input use_cross is not true.

8. Cross Command

Runs the given subcommand using cross and the provided arguments, if the input use_cross is true.

9. Gather Outputs

Collects all possible outputs in a common directory (target/.dist). This is necessary because Cargo creates numerous files and directories at different levels of nesting with no fixed path to the binaries or the documentation across all platforms.

10. Upload Artifact

Uploads the files in the form of an artifact and names it artifact-${{ inputs.subcommand }}-${{ inputs.compilation_target }}. Some examples of possible artifact names: artifact-build-x86_64-unknown-linux-gnu, artifact-doc-x86_64-unknown-linux-gnu, artifact-build-x86_64-pc-windows-msvc, artifact-build-aarch64-apple-darwin.

Outputs

The artifact that contains the built binaries or documentation if relevant. Otherwise none. The action fails if any of the steps encounter an error. Otherwise it succeeds.

github_action-rust's People

Contributors

pvshvp-oss avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.