engineering-repr 1.1.1

Numeric conversions for engineering notation (1.23k) and the RKM code variant (1k23)
Documentation
name: Rust

on:
  push:
    branches: ["main", "dev"]
  pull_request:
    branches: ["main", "dev"]
  workflow_dispatch:

env:
  CARGO_TERM_COLOR: always
  CLICOLOR_FORCE: 1
  RUST_BACKTRACE: 1
  CARGO_INCREMENTAL: 0

jobs:
  checks:
    name: checks @${{ matrix.rust-version }}
    runs-on: ubuntu-latest
    timeout-minutes: 30
    strategy:
      fail-fast: false # useful for testing
      matrix:
        rust-version: [1.74.0, stable]
        cache: [true]
        include:
          - rust-version: nightly
            cache: false
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust ${{ matrix.rust-version }}
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust-version }}
          components: rustfmt,clippy,rust-src

      ####### Ensure all tools are loaded before rust-cache, or they will be cached themselves ######
      - uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
        with:
          key: ${{ matrix.rust-version }}
          cache-on-failure: true
        if: ${{ matrix.cache && !cancelled() }}

      # Within this workflow we will continue on error, to give
      # maximum information to the developer.
      - run: cargo fmt --all --check
        if: ${{ !cancelled() }}
      - run: cargo test --all-features
      - run: cargo clippy --tests --workspace
        if: ${{ !cancelled() }}

  docs:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    env:
      RUSTDOCFLAGS: -Dwarnings
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@master
        with:
          # update periodically
          toolchain: nightly-2025-07-31
          components: rust-src
      - uses: dtolnay/install@cargo-docs-rs
      ####### Ensure all tools are loaded before rust-cache, or they will be cached themselves ######
      - uses:
          Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
          # this action is used in multiple places
        with:
          cache-on-failure: true
      - run: cargo docs-rs
      # Continue on error for maximum information
      - run: cargo doc --no-deps --document-private-items
        if: ${{ !cancelled() }}

  coverage:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
      - name: Install Rust
        uses:
          dtolnay/rust-toolchain@master
          # this action is used in multiple places
        with:
          # update periodically
          toolchain: nightly-2025-07-31
          components: llvm-tools-preview,rust-src
      - uses:
          taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b # v2.50.4
          # this action is used in multiple places
        with:
          tool: cargo-llvm-cov
          checksum: true
      - uses:
          Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
          # this action is used in multiple places
        with:
          cache-on-failure: true
          cache-all-crates: true
      - name: Run coverage tests
        run: cargo llvm-cov --all-features --workspace --exclude xtask@0.0.0 --lcov --output-path lcov.info
      - name: Upload coverage artifact
        uses: actions/upload-artifact@v4
        with:
          name: lcov.info
          path: lcov.info
      - name: Send result to codecov
        uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24 # v5.4.3
        with:
          #files: lcov.info # not needed, it autodetects
          #verbose: true # not needed
          name: lcov
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}