name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
features:
- "" - "async"
- "async,log"
- "log"
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --verbose --no-default-features --features "${{ matrix.features }}"
- name: Run tests
run: cargo test --verbose --no-default-features --features "${{ matrix.features }}"
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Run clippy (no features)
run: cargo clippy --no-default-features -- -D warnings
- name: Run clippy (async)
run: cargo clippy --all-features -- -D warnings
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all -- --check
examples:
name: Examples
runs-on: ubuntu-latest
strategy:
matrix:
example:
- esp-alarm
- esp-temperature
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: riscv32imac-unknown-none-elf
components: rustfmt
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check formatting of ${{ matrix.example }} example
run: cd examples/${{ matrix.example }} && cargo fmt --all -- --check
- name: Build ${{ matrix.example }} example
run: cd examples/${{ matrix.example }} && cargo build
- name: Run clippy on ${{ matrix.example }} example
run: cd examples/${{ matrix.example }} && cargo clippy -- -D warnings
coverage:
name: Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Generate coverage (blocking)
run: cargo llvm-cov --no-report test --features temperature_f32
- name: Generate coverage (blocking,log)
run: cargo llvm-cov --no-report test --features "log,temperature_f32"
- name: Generate coverage (async)
run: cargo llvm-cov --no-report test --features "async,temperature_f32"
- name: Generate coverage (async,log)
run: cargo llvm-cov --no-report test --features "async,log,temperature_f32"
- name: Generate coverage report
run: cargo llvm-cov report --lcov --output-path lcov.info
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
fail-on-error: true