Skip to content

Rust Cargo integration

Actions
Integration Rust Cargo with GitHub Actions
v1.0.4
Latest
By qRoC
Star (5)

Integration Rust Cargo with GitHub Actions

Overview

General result
General result
Error in code
Error in code
Failed test
Failed test

Inputs

  • Required command: Cargo command like build, check, test, etc.
  • args: Arguments for the cargo command.
  • manifest-path: Path to the Cargo.toml. By default, is the working directory.
  • token: GitHub token. Used for enable more powerful annotation system. Strongly recommended*
  • toolchain: Toolchain to use. For example: nightly.

* Default GitHub Actions annotations supports only up to 10 warnings and 10 errors for per the step. With token you up this limit to 1000

Outputs

  • notice_count: Notice count.
  • warning_count: Warning count.
  • failure_count: Failure count.

Example

# if `with.token` is used
permissions:
  checks: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: qRoC/cargo-actions@v1
        with:
          command: build
          args: --verbose
          token: ${{ secrets.GITHUB_TOKEN }}

  code_style:
    continue-on-error: true
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: qRoC/cargo-actions@v1
        with:
          command: fmt
          toolchain: nightly
          args: --all -- --check
          token: ${{ secrets.GITHUB_TOKEN }}

  lint:
    continue-on-error: true
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: qRoC/cargo-actions@v1
        with:
          command: clippy
          args: --all-features --all-targets -- -D warnings
          token: ${{ secrets.GITHUB_TOKEN }}

  tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: qRoC/cargo-actions@v1
        with:
          command: test
          args: --all-features --no-fail-fast --jobs 1
          token: ${{ secrets.GITHUB_TOKEN }}

  audit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: qRoC/cargo-actions@v1
        with:
          command: audit

For developers

  1. Install the dependencies.
$ yarn install
  1. Do some changes.

  2. Build the typescript and package it for distribution.

$ yarn build && yarn package
  1. Run the tests.
$ yarn test
  1. Publish changes.
$ git add -A
$ git commit -m "..."
$ git push origin main
  1. Move distribution tag.
git tag -fa v1 -m "Update v1 tag"
git push origin main --force

Rust Cargo integration is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Integration Rust Cargo with GitHub Actions
v1.0.4
Latest
By qRoC

Rust Cargo integration is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.