oxiflow 0.6.0

Generic PDE solving engine for transport, reaction and diffusion phenomena (∂u/∂t + ∇·F = S)
Documentation
name: CI

on:
  push:
    branches: ["**"]
  pull_request:
    branches: ["**"]

jobs:
  # ────────────────────────────────────────────────────────────────────────────
  # Format — checks that code conforms to rustfmt
  # ────────────────────────────────────────────────────────────────────────────
  fmt:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7

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

      - name: cargo fmt --check
        run: cargo fmt --check

  # ────────────────────────────────────────────────────────────────────────────
  # Clippy — zero warnings allowed
  # ────────────────────────────────────────────────────────────────────────────
  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    needs: fmt
    steps:
      - uses: actions/checkout@v7

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

      - name: cargo clippy — default features
        run: cargo clippy -- -D warnings

      # DD-043 (#50) — sparse linear algebra backend (faer). No system
      # dependency needed, but requires rustc 1.84+ (faer 0.24's own MSRV,
      # above this crate's own rust-version = "1.80") — @stable is expected
      # to satisfy this; revisit if it ever regresses below 1.84.
      - name: cargo clippy — feature sparse
        run: cargo clippy --features sparse -- -D warnings

      # DD-027 (#75, migrated to hdf5-metno per #79) — needs libhdf5's C
      # headers, discovered via pkg-config. No code uses this feature yet
      # (ExternalTabulated not implemented) — this only guards against the
      # dependency itself becoming unbuildable.
      - name: Install system dependencies (HDF5)
        run: |
          sudo apt-get update -q
          sudo apt-get install -y --no-install-recommends libhdf5-dev pkg-config

      - name: cargo clippy — feature hdf5
        run: cargo clippy --features hdf5 -- -D warnings

      # J5 (v0.7) — activate when consumed for real:
      # parallel/serde are already declared in Cargo.toml but not yet
      # exercised by any real threshold-triggered or serialized code path.
      # - name: cargo clippy — feature parallel
      #   run: cargo clippy --features parallel -- -D warnings
      # - name: cargo clippy — feature serde
      #   run: cargo clippy --features serde -- -D warnings

  # ────────────────────────────────────────────────────────────────────────────
  # Test — unit and integration test suite
  # ────────────────────────────────────────────────────────────────────────────
  test:
    name: Test
    runs-on: ubuntu-latest
    needs: fmt
    steps:
      - uses: actions/checkout@v7

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

      - name: cargo test — default features
        run: cargo test

      # DD-043 (#50) — see the clippy job for the rustc 1.84+ note.
      - name: cargo test — feature sparse
        run: cargo test --features sparse

      # DD-027 (#75, migrated to hdf5-metno per #79).
      - name: Install system dependencies (HDF5)
        run: |
          sudo apt-get update -q
          sudo apt-get install -y --no-install-recommends libhdf5-dev pkg-config

      - name: cargo test — feature hdf5
        run: cargo test --features hdf5

      # J5 (v0.7) — activate when consumed for real (see the clippy job).
      # - name: cargo test — feature parallel
      #   run: cargo test --features parallel
      # - name: cargo test — feature serde
      #   run: cargo test --features serde

  # ────────────────────────────────────────────────────────────────────────────
  # Doc — generation and deployment to GitHub Pages
  # Triggered on push to main only
  # ────────────────────────────────────────────────────────────────────────────
  doc:
    name: Documentation
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main' && github.event_name == 'push'
    needs: [clippy, test]
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v7

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

      - name: cargo doc — build with KaTeX header
        run: RUSTDOCFLAGS="--html-in-header docs/katex-header.html" cargo doc --no-deps

      - name: Add root redirect to oxiflow/index.html
        run: |
          echo '<meta http-equiv="refresh" content="0; url=oxiflow/index.html">' \
            > target/doc/index.html

      - name: Deploy to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./target/doc
          enable_jekyll: false