moneylib 0.12.0

Library to deal with money in Rust.
Documentation
name: ci

env:
  RUST_VERSION: 1.91.1

on:
  pull_request:
    branches: [master]
    types: [opened, synchronize, reopened, ready_for_review]
  workflow_dispatch: {}

concurrency:
  group: moneylib-ci
  cancel-in-progress: false

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: TruffleHog Leaks Scan
        uses: trufflesecurity/trufflehog@v3.91.2
        with:
          extra_args: --only-verified

      - name: Cache run data
        id: cache-cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_VERSION }}
          override: true

      - name: Install clippy
        run: |
          if cargo clippy --version &>/dev/null; then
            echo "clippy already installed, skipping."
          else
            rustup component add clippy --toolchain ${{ env.RUST_VERSION }}
          fi

      - name: Run cargo check
        uses: actions-rs/cargo@v1
        with:
          command: check
          args: --all-features

      - name: Run cargo clippy
        uses: actions-rs/cargo@v1
        with:
          command: clippy
          args: --all-features

  test:
    name: Test
    runs-on: ubuntu-latest
    needs: check
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v6

      - name: Cache run data
        id: cache-cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_VERSION }}
          override: true

      - name: Run cargo test
        uses: actions-rs/cargo@v1
        with:
          command: test
          args: --all-features

  coverage:
    name: Coverage
    runs-on: ubuntu-latest
    needs: test
    steps:
      - name: Checkout codebase
        uses: actions/checkout@v6

      - name: Cache run data
        id: cache-cargo
        uses: actions/cache@v4
        with:
          path: |
            ~/.cargo/registry
            ~/.cargo/git
            ~/.cargo/bin
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

      - name: Install stable toolchain
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: ${{ env.RUST_VERSION }}
          override: true
      
      - name: Install cargo-llvm-cov
        run: |
          if cargo llvm-cov --version &>/dev/null; then
            echo "cargo-llvm-cov already installed, skipping."
          else
            cargo install cargo-llvm-cov --locked
          fi

      - name: Run cargo llvm-cov
        run: make lcov

      - name: Upload coverage to Codecov
        uses: codecov/codecov-action@v5
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: ./target/coverage/lcov.info
          fail_ci_if_error: true