promptparse 1.1.0

All-in-one Rust library for PromptPay & EMVCo QR Codes
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always

jobs:
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macos-latest]
        rust: [stable, beta, nightly]
        exclude:
          # Reduce matrix size by excluding some combinations
          - os: windows-latest
            rust: beta
          - os: macos-latest
            rust: beta

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: ${{ matrix.rust }}
          profile: minimal
          override: true
          components: rustfmt, clippy

      - name: Cache cargo registry
        uses: actions/cache@v3
        with:
          path: |

            ~/.cargo/registry
            ~/.cargo/git
            target
          key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |

            ${{ runner.os }}-cargo-

      - name: Check formatting
        if: matrix.rust == 'stable'
        run: cargo fmt --all -- --check

      - name: Run clippy
        if: matrix.rust == 'stable'
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Build
        run: cargo build --verbose

      - name: Run unit tests
        run: cargo test --verbose

      - name: Run integration tests
        run: cargo test --test integration_tests --verbose

      - name: Run lib tests
        run: cargo test --test lib_tests --verbose

      - name: Run examples
        run: cargo run --example basic_usage

      - name: Test documentation
        if: matrix.rust == 'stable'
        run: cargo doc --no-deps --document-private-items

  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Install cargo-tarpaulin
        run: cargo install cargo-tarpaulin

      - name: Run cargo-tarpaulin
        run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out xml

      - name: Upload coverage artifact
        uses: actions/upload-artifact@v4
        with:
          name: coverage-report
          path: cobertura.xml

  security:
    name: Security Audit
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain
        uses: actions-rs/toolchain@v1
        with:
          toolchain: stable
          profile: minimal
          override: true

      - name: Install cargo-audit
        run: cargo install cargo-audit

      - name: Run security audit
        run: cargo audit

  minimum-rust-version:
    name: Minimum Rust Version
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Install Rust toolchain (MSRV)
        uses: actions-rs/toolchain@v1
        with:
          toolchain: 1.70.0  # Minimum supported Rust version
          profile: minimal
          override: true

      - name: Build with MSRV
        run: cargo build --verbose

      - name: Test with MSRV
        run: cargo test --verbose