marg-orientation 0.1.0-alpha.2

A MARG (Magnetic, Angular Rate, and Gravity) orientation estimator
Documentation
---
name: Rust

on:
  push:
    branches: [ "main" ]
    paths:
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'src/**'
      - '.github/workflows/rust.yml'
  pull_request:
    branches: [ "main" ]
    paths:
      - 'Cargo.toml'
      - 'Cargo.lock'
      - 'src/**'
      - '.github/workflows/rust.yml'

env:
  CARGO_TERM_COLOR: always

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Check format
        run: cargo fmt --check
      - name: Clippy
        run: cargo clippy

  docs:
    name: Build documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build documentation
        run: cargo doc

  codecov:
    needs: lint
    name: Code Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Build
        run: cargo build --verbose
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview
      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov
      - name: Install nextest
        uses: taiki-e/install-action@nextest
      - name: Generate code coverage
        run: cargo llvm-cov nextest --features=std,unsafe --package marg-orientation --lcov --output-path lcov.info
      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v4.0.1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: lcov.info
          fail_ci_if_error: true

  build-std:
    needs:
      - lint
      - docs
    name: Build and Test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run doctests
        run: cargo test --doc --verbose --package marg-orientation --no-default-features --features=std

  build-others:
    needs:
      - codecov
      - build-std
    name: Build and Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ macos-latest, windows-latest ]
    steps:
      - uses: actions/checkout@v4
      - name: Run tests
        run: cargo test --package marg-orientation --verbose --features=std
      - name: Run doctests
        run: cargo test --doc --package marg-orientation --verbose --features=std