iof 0.5.0

Read from and write data to console or file in simple formats.
Documentation
on:
  push:
    branches: "*"
  schedule:
    - cron: "0 0 */14 * *" # Run benchmarks every 14 days at midnight.

name: Lint and Test

env:
  RUSTFLAGS: "-Dwarnings"
  RUST_BACKTRACE: 1

jobs:
  check:
    name: Test
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    env:
      OS: ${{ matrix.os }}
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: Install Rust Toolchain
        id: toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: "1.82"
      - name: cargo test
        run: cargo test --workspace
      - name: cargo test with features
        run: cargo test --workspace --all-features

  miri:
    name: MIRI Test
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: Install Rust Toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: nightly
          components: miri
      - name: cargo miri
        run: cargo miri test --workspace

  coverage:
    name: Lint and Test Coverage
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    env:
      OS: ${{ matrix.os }}
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4
      - name: Install Rust Toolchain
        id: toolchain
        uses: dtolnay/rust-toolchain@v1
        with:
          toolchain: stable
          components: llvm-tools-preview, rustfmt, clippy
      - name: cargo fmt
        run: cargo fmt --all -- --check
      - name: cargo clippy
        run: cargo clippy --workspace --all-targets
      - name: cargo clippy with features
        run: cargo clippy --workspace --all-targets --all-features
      - name: cargo doc
        run: cargo doc --workspace --no-deps
      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov
      - name: Generate Code Coverage
        run: cargo llvm-cov --workspace --lcov --output-path lcov.info
      - name: Upload Results to Codecov
        uses: codecov/codecov-action@v5
        env:
          RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
          FEATURES: false
        with:
          files: lcov.info
          flags: unittests
          name: iof
          env_vars: OS,RUSTUP_TOOLCHAIN,FEATURES
          # Failing to upload results will cause a CI error.
          # So remember to use a token.
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true
      - name: Generate Code Coverage with Features
        run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info
      - name: Upload Results with Features to Codecov
        uses: codecov/codecov-action@v5
        env:
          RUSTUP_TOOLCHAIN: ${{ steps.toolchain.outputs.name }}
          FEATURES: true
        with:
          files: lcov.info
          flags: unittests
          name: iof
          env_vars: OS,RUSTUP_TOOLCHAIN,FEATURES
          # Failing to upload results will cause a CI error.
          # So remember to use a token.
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true