chore: updated workflows #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: | |
- "**" | |
tags-ignore: | |
- "*" | |
jobs: | |
linting: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Clippy | |
run: | | |
rustup component add clippy | |
cargo clippy --all-targets --all-features -- -D warnings | |
- name: Rustfmt | |
run: cargo fmt -- --check | |
test: | |
needs: | |
- linting | |
strategy: | |
matrix: | |
environment: | |
- os: "ubuntu-latest" | |
target: "x86_64-unknown-linux-gnu" | |
cross: true | |
- os: "macos-10.15" | |
target: "x86_64-apple-darwin" | |
cross: true | |
- os: "ubuntu-latest" | |
target: "x86_64-pc-windows-gnu" | |
cross: true | |
packages: "gcc-mingw-w64" | |
- os: "ubuntu-latest" | |
target: "armv7-unknown-linux-gnueabihf" | |
cross: true | |
packages: "gcc-arm-linux-gnueabihf" | |
runs-on: "${{ matrix.environment.os }}" | |
name: "${{ matrix.environment.os }} (${{ matrix.environment.target }})" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
target: ${{ matrix.environment.target }} | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/registry | |
~/.cargo/git | |
target | |
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }} | |
- name: Install system packages | |
if: matrix.environment.packages | |
run: | | |
sudo apt-get update; | |
sudo apt-get install -qq ${{ matrix.environment.packages }}; | |
- name: Install cross | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build (with cross) | |
if: ${{ matrix.environment.cross }} | |
run: cross build --target ${{ matrix.environment.target }} | |
- name: Build (without cross) | |
if: ${{ !matrix.environment.cross }} | |
run: cargo build | |
coverage: | |
needs: | |
- linting | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install perftools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libgoogle-perftools-dev | |
- name: Install rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: nightly | |
- name: Cargo clean | |
run: cargo clean | |
- name: Cargo test | |
run: cargo test --all-features --no-fail-fast | |
env: | |
CARGO_INCREMENTAL: "0" | |
RUSTFLAGS: "-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off" | |
- id: coverage | |
uses: actions-rs/grcov@v0.1 | |
- uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ${{ steps.coverage.outputs.report }} |