chore: clarified nix installation in README #179
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-latest" | |
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 | |
env: | |
CARGO_TERM_COLOR: always | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update stable | |
- name: Install cargo-llvm-cov | |
uses: taiki-e/install-action@cargo-llvm-cov | |
- name: Generate code coverage | |
run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | |
files: lcov.info | |
fail_ci_if_error: true |