positive 0.8.0

A type-safe wrapper for guaranteed positive decimal values
Documentation
name: Code Coverage Report.

on:
  push:
    branches:
      - main
      - 'feature/**'
      - 'fix/**'
      - 'release/**'
  pull_request:
    branches:
      - main
      - 'release/**'

permissions:
  contents: read

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  CARGO_NET_RETRY: 3
  RUSTUP_MAX_RETRIES: 3
  # Pinned so a coverage run is reproducible and so the cache key below has
  # something stable to key on. Bump both together.
  TARPAULIN_VERSION: '0.37.5'

jobs:
  code_coverage_report:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        # actions/checkout v7.0.1
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

      # One toolchain step. The previous job piped curl into sh inside a retry
      # action, then declared an `if: failure()` fallback that could never run,
      # then verified the install with a `source ~/.cargo/env || true`.
      - name: Install Rust
        # dtolnay/rust-toolchain master (the generic action; the version branches
        # such as `1.14` hardcode that Rust release and reject a `toolchain` input)
        uses: dtolnay/rust-toolchain@6c977a6ca4077a0ceb28ffbe03f59d46e9ac8772
        id: toolchain
        with:
          toolchain: stable
          components: llvm-tools-preview

      - name: Cache Rust dependencies
        # actions/cache v6.1.0
        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
        with:
          path: |
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-coverage-${{ steps.toolchain.outputs.cachekey }}-${{ hashFiles('**/Cargo.toml') }}
          restore-keys: |
            ${{ runner.os }}-coverage-${{ steps.toolchain.outputs.cachekey }}-

      # cargo-tarpaulin was rebuilt from source on every run, which dominated
      # the job. It is now pinned and cached on its own key, so it is compiled
      # once per version rather than once per push.
      - name: Cache cargo-tarpaulin
        id: cache-tarpaulin
        # actions/cache v6.1.0
        uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
        with:
          path: ~/.cargo/bin/cargo-tarpaulin
          key: ${{ runner.os }}-tarpaulin-${{ env.TARPAULIN_VERSION }}

      - name: Install cargo-tarpaulin
        if: steps.cache-tarpaulin.outputs.cache-hit != 'true'
        run: cargo install cargo-tarpaulin --version ${{ env.TARPAULIN_VERSION }} --locked

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y make

      - name: Generate code coverage report
        run: >
          cargo tarpaulin --color Always --engine llvm --verbose --tests
          --all-targets --all-features --workspace --timeout 600 --out Xml

      - name: Upload coverage reports to Codecov.io
        # codecov/codecov-action v5.5.5
        uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f
        with:
          fail_ci_if_error: true
        env:
          CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}