sprs 0.11.0

A sparse matrix library
Documentation
name: CI

on:
  push:
  pull_request:
    branches:
    - master
  schedule:
  - cron: '0 0 15 * *'

env:
    CARGO_TERM_COLOR: always
    RUSTFLAGS: -D warnings
    CLIPPY_DISABLE_DOCS_LINKS: 1

jobs:
  rustfmt:
    name: rustfmt
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        profile: minimal
        components: rustfmt
    - name: Check formatting
      run: cargo fmt -- --check

  documentation:
    name: documentation
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        profile: minimal
    - name: Documentation
      run: cargo doc --all-features --workspace

  clippy:
    name: clippy
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
        toolchain: stable
        override: true
        profile: minimal
        components: clippy
    - name: Run Clippy
      run: cargo clippy --workspace --all-features -- -W clippy::doc_markdown -W clippy::needless_borrow -W clippy::checked_conversions -W clippy::unseparated_literal_suffix -W clippy::unreadable_literal -W clippy::if_not_else -W clippy::needless_continue -W clippy::match_same_arms -W clippy::match_wildcard_for_single_variants -W clippy::explicit_into_iter_loop -W clippy::needless_borrow

  test:
    name: test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
        - build: msrv
          os: ubuntu-18.04
          rust: 1.49.0
        - build: stable
          os: ubuntu-18.04
          rust: stable
        - build: beta
          os: ubuntu-18.04
          rust: beta
        - build: nightly
          os: ubuntu-18.04
          rust: nightly
        - build: macos
          os: macos-latest
          rust: stable
        - build: win-msvc
          os: windows-2019
          rust: stable
        - build: win-gnu
          os: windows-2019
          rust: stable
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}

    - name: Install suitesparse
      if: matrix.os == 'ubuntu-18.04'
      run: |
          sudo apt-get install libsuitesparse-dev

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

    - name: Build (exclude suitesparse)
      run: cargo build --verbose --workspace --exclude suitesparse_ldl_sys --exclude sprs_suitesparse_ldl --exclude sprs_suitesparse_camd --exclude suitesparse_camd_sys
      if: matrix.os != 'ubuntu-18.04'

    - name: Build (all)
      run: cargo build --verbose --workspace
      if: matrix.os == 'ubuntu-18.04'

    - name: Test (exclude suitesparse)
      run: cargo test --verbose --workspace --exclude suitesparse_ldl_sys --exclude sprs_suitesparse_ldl --exclude sprs_suitesparse_camd --exclude suitesparse_camd_sys
      if: matrix.os != 'ubuntu-18.04'

    - name: Test (all)
      run: cargo test --verbose --workspace
      if: matrix.os == 'ubuntu-18.04'

    - name: Test (suitesparse integration)
      run: cargo test -p sprs-ldl --features "sprs-ldl/sprs_suitesparse_ldl sprs-ldl/sprs_suitesparse_camd"
      if: matrix.os == 'ubuntu-18.04' && matrix.build == 'nightly'

  benches:
    name: benchmarks
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install dependencies
      run: |
          sudo apt-get install libeigen3-dev libsuitesparse-dev
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          override: true
          profile: minimal
    - name: Run benchmarks
      run: |
          cargo bench --workspace

  optional_none:
    name: Optional features (none selected)
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          override: true
          profile: minimal
    - name: Run test
      run: |
          cargo test --no-default-features

  optional_approx:
    name: Optional features (approx selected)
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          override: true
          profile: minimal
    - name: Run test
      run: |
          cargo test --features approx

  static_suitesparse:
    name: static SuiteSparse
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        include:
        - build: stable
          os: ubuntu-18.04
          rust: stable
        - build: macos
          os: macos-latest
          rust: stable
        - build: win-msvc
          os: windows-2019
          rust: stable
        - build: win-gnu
          os: windows-2019
          rust: stable
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: true}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          override: true
          profile: minimal
    - name: Run tests (camd)
      run: |
          cd suitesparse_bindings/sprs_suitesparse_camd
          cargo test --features suitesparse_camd_sys/static
    - name: Run tests (ldl)
      run: |
          cd suitesparse_bindings/sprs_suitesparse_ldl
          cargo test --features suitesparse_ldl_sys/static
  miri:
    name: Miri
    runs-on: ubuntu-18.04
    steps:
    - name: Checkout repository
      uses: actions/checkout@v2
      with: {submodules: false}
    - name: Install rust
      uses: actions-rs/toolchain@v1
      with:
          toolchain: nightly
          override: true
          profile: minimal
          components: miri
    - name: Run test
      run: |
          cargo miri test --no-default-features --features alga,approx,serde