name: Rust
on:
push:
branches:
- master
pull_request:
branches:
- "**"
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: "1"
RUSTFLAGS: "-D warnings"
RUST_NIGHTLY_TOOLCHAIN: "nightly-2023-05-19"
jobs:
required:
name: Required
needs:
- rust
- license
runs-on: ubuntu-20.04
steps:
- name: Check results
run: |
[[ ${{ needs.rust.result }} == 'success' ]] || exit 1;
[[ ${{ needs.license.result }} == 'success' ]] || exit 1;
license:
name: License
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Check License Header
uses: apache/skywalking-eyes/header/@d299844e334855087f18ae1fe3c81ae8d22bc282
with:
config: .licenserc.yaml
- name: Check Dependencies License
uses: apache/skywalking-eyes/dependency/@d299844e334855087f18ae1fe3c81ae8d22bc282
with:
config: .licenserc.yaml
rust:
name: Rust
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- macos-12
- windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
components: rustfmt, clippy
- name: Setup cargo cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}--${{ hashFiles('**/Cargo.lock') }}
- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
command: fmt
args: --all -- --check
if: matrix.os != 'windows-2022'
- name: Cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --release --workspace
- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --release --workspace
- name: Cargo doc
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN }}
command: doc
args: --workspace --no-deps --all-features