rusty-money 0.5.0

Parse, format and perform calculations with money safely.
Documentation
name: Rust

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - master

concurrency:
  group: rust-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

permissions:
  contents: read
  actions: read

jobs:
  test:
    strategy:
      matrix:
        toolchain:
          - stable
          - beta
          - nightly
      fail-fast: false
    runs-on: ubuntu-22.04
    name: "Rust ${{ matrix.toolchain }} tests"
    # We ignore the possible error that could be present on nightly
    continue-on-error: ${{ matrix.toolchain == 'nightly' }}
    steps:
      - name: Checkout the project
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

      - name: Setup rust cache
        uses: Swatinem/rust-cache@2656b87321093db1cb55fbd73183d195214fdfd1 # v2.5.0
        with:
          key: ${{ matrix.toolchain }}

      - name: Install rust ${{ matrix.toolchain }} toolchain
        # We add the `clippy` component only on `stable`
        run: rustup toolchain add ${{ matrix.toolchain }} ${{ matrix.toolchain == 'stable' && '--component=clippy' || '' }}

      - name: Check rust is formatted
        if: ${{ matrix.toolchain == 'stable' }}
        run: cargo fmt --check

      - name: Check clippy
        if: ${{ matrix.toolchain == 'stable' }}
        run: cargo clippy --all-features --all-targets

      - name: Execute cargo tests
        env:
          PROPTEST_CASES: 10000
        run: cargo +${{ matrix.toolchain }} test --verbose --all-features