qfall-math 0.2.1

Mathematical foundations for rapid prototyping of lattice-based cryptography
Documentation
name: Pipeline
# consistency regarding formatting and idiomatic Rust

on:
  push:
    branches-ignore:
      - main
      - dev

permissions:
  contents: read

# a new run for the same branch or pull request cancels the outdated run
concurrency:
  group: ${{ github.workflow_ref }}
  cancel-in-progress: true

env:
  CARGO_TERM_COLOR: always
  RUSTDOCFLAGS: "-Dwarnings"

jobs:
  pipeline:
    name: Pipeline - test and lints
    runs-on: ubuntu-latest
    timeout-minutes: 90
    
    steps:
      - uses: actions/checkout@v7

      - name: Setup dtolnay/rust-toolchain 
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      # The native FLINT library is compiled for the CPU of the runner it is built on.
      # Hence, the cache may only be reused on runners with the same CPU (model and features).
      - name: Determine CPU of the runner
        id: cpu
        run: |

          grep -m1 'model name' /proc/cpuinfo
          echo "hash=$({ grep -m1 'model name' /proc/cpuinfo; grep -m1 '^flags' /proc/cpuinfo; } | sha256sum | cut -c1-16)" >> "$GITHUB_OUTPUT"

      # load project cache to reduce compilation time, whose key additionally covers
      # the Rust version, the Cargo.toml files, and build-relevant environment variables
      - name: Setup project cache
        uses: Swatinem/rust-cache@v2
        with:
          key: ${{ steps.cpu.outputs.hash }}

      - name: Update dependencies
        run: cargo update
      - name: Build
        run: cargo build
      - name: Generate docs
        run: cargo doc --no-deps
      
      - name: Test
        run: cargo test --verbose

      # Lints: Clippy and Fmt
      - name: Clippy
        run: cargo clippy -- -D warnings
      - name: Format
        run:  cargo fmt --all -- --check