frenchrs 0.1.3

A high-performance Rust library for asset pricing and financial analysis, built on the robust econometric infrastructure of [Greeners](https://crates.io/crates/greeners).
Documentation
name: CI

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

env:
  CARGO_TERM_COLOR: always
  RUST_BACKTRACE: 1

jobs:
  # Test on multiple Rust versions and operating systems
  test:
    name: Test Suite
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        rust: [stable, beta, nightly]
        exclude:
          # Reduce matrix size - only test nightly on Ubuntu
          - os: macos-latest
            rust: nightly
          - os: windows-latest
            rust: nightly
          - os: macos-latest
            rust: beta
          - os: windows-latest
            rust: beta
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.rust }}

      # Linux-specific: Install OpenBLAS for ndarray-linalg
      - name: Install OpenBLAS (Linux)
        if: runner.os == 'Linux'
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

      # macOS-specific: Install OpenBLAS
      - name: Install OpenBLAS (macOS)
        if: runner.os == 'macOS'
        run: brew install openblas

      # Windows-specific: Use vcpkg to install OpenBLAS
      - name: Cache vcpkg packages (Windows)
        if: runner.os == 'Windows'
        uses: actions/cache@v4
        with:
          path: |
            C:\vcpkg\installed
            C:\vcpkg\packages
          key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-vcpkg-

      - name: Install OpenBLAS via vcpkg (Windows)
        if: runner.os == 'Windows'
        shell: pwsh
        run: |
          # vcpkg is pre-installed on GitHub Actions Windows runners
          echo "VCPKG_ROOT=C:\vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

          # Install OpenBLAS (static linking with dynamic runtime)
          C:\vcpkg\vcpkg.exe install openblas:x64-windows-static-md

          # Integrate vcpkg with build system
          C:\vcpkg\vcpkg.exe integrate install

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

      - name: Cache cargo index
        uses: actions/cache@v4
        with:
          path: ~/.cargo/git
          key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-index-

      - name: Cache cargo build
        uses: actions/cache@v4
        with:
          path: target
          key: ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}
          restore-keys: |
            ${{ runner.os }}-cargo-build-target-${{ matrix.rust }}-
            ${{ runner.os }}-cargo-build-target-

      - name: Check build
        run: cargo check --all-targets --all-features

      - name: Run tests
        run: cargo test --all-features --no-fail-fast

      - name: Run doc tests
        run: cargo test --doc

  # Clippy linting
  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy

      - name: Install OpenBLAS
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

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

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

  # Format checking
  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt

      - name: Check formatting
        run: cargo fmt --all -- --check

  # Documentation build
  docs:
    name: Documentation
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install OpenBLAS
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

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

      - name: Check documentation
        run: cargo doc --no-deps --all-features
        env:
          RUSTDOCFLAGS: -D warnings

  # Security audit
  security-audit:
    name: Security Audit
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

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

      - name: Run security audit
        run: cargo audit

  # Coverage (only on Linux with stable Rust)
  coverage:
    name: Code Coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable
        with:
          components: llvm-tools-preview

      - name: Install OpenBLAS
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

      - name: Install cargo-llvm-cov
        uses: taiki-e/install-action@cargo-llvm-cov

      - name: Generate coverage
        run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info

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

  # Check that examples compile and run
  examples:
    name: Examples
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust
        uses: dtolnay/rust-toolchain@stable

      - name: Install OpenBLAS
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

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

      - name: Build examples
        run: cargo build --examples

      - name: Check example executables exist
        run: |
          ls -la target/debug/examples/
          test -f target/debug/examples/grs_test_example
          test -f target/debug/examples/residual_diagnostics_example

  # Minimum Supported Rust Version (MSRV) check
  msrv:
    name: MSRV Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install Rust 1.70
        uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "1.70"

      - name: Install OpenBLAS
        run: sudo apt-get update && sudo apt-get install -y libopenblas-dev gfortran

      - name: Check MSRV
        run: cargo check --all-features