foyer-bytesize 2.0.0

An utility for human-readable bytes representations. Forked from https://github.com/hyunsik/bytesize .
Documentation
name: Rust

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

env:
  CARGO_TERM_COLOR: always
  CACHE_KEY_SUFFIX: 20240821

jobs:
  rust:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust_toolchain: [stable, 1.81.0]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust_toolchain }}
          components: rustfmt, clippy, llvm-tools-preview
      - name: Cache Cargo home
        uses: actions/cache@v4
        id: cache
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}-${{ env.CACHE_KEY_SUFFIX }}-rust-test
      - name: Install cargo tools
        if: steps.cache.outputs.cache-hit != 'true'
        run: |
          cargo install cargo-sort --locked
      - name: Run rust cargo-sort check
        # https://github.com/DevinR528/cargo-sort/issues/56
        if: matrix.os != 'windows-latest'
        run: |
          cargo sort -w -c
      - name: Run rust format check
        run: |
          cargo fmt --all -- --check
      - name: Run rust clippy check
        run: |
          cargo clippy --all-features -- -D warnings
      - if: steps.cache.outputs.cache-hit != 'true'
        uses: taiki-e/install-action@cargo-llvm-cov
      - name: Run rust test with coverage
        env:
          RUST_BACKTRACE: 1
        run: |
          cargo llvm-cov test --all-features
      - name: Run rust doc test
        env:
          RUST_BACKTRACE: 1
        run: |
          cargo test --doc --all-features
      - uses: codecov/codecov-action@v4
        if: runner.os == 'Linux' && matrix.rust_toolchain == 'stable'
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
        with:
          verbose: true