decaf377 0.10.1

A prime-order group designed for use in SNARKs over BLS12-377
Documentation
on: [pull_request]

name: Rust CI

jobs:
  check:
    name: Check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
      - name: Load rust cache
        uses: astriaorg/buildjet-rust-cache@v2.5.1
      - name: Run cargo check, failing on warnings
        run: cargo check --profile ci --all-targets
        # It'd be nice to fail on warnings, but we're not ready for that.
        # env:
        #   RUSTFLAGS: "-D warnings"

  test:
    name: Test Suite
    runs-on: buildjet-16vcpu-ubuntu-2204
    # We want to run the tests twice, once with the
    # default backend (u64) and one with the u32_backend,
    # in both cases with the r1cs feature enabled.
    strategy:
      matrix:
        backend: ["r1cs", "r1cs,u32_backend"]
    steps:
      - uses: actions/checkout@v4
      - name: Install rust toolchain
        uses: dtolnay/rust-toolchain@stable
      - name: Install nextest
        uses: taiki-e/install-action@nextest
      - name: Load rust cache
        uses: astriaorg/buildjet-rust-cache@v2.5.1
      - name: Run tests with nextest
        run: cargo nextest run --cargo-profile ci --profile ci --features ${{ matrix.backend }}
        env:
          CARGO_TERM_COLOR: always

  build_no_alloc:
    name: build without alloc
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      - run: rustup target add thumbv7em-none-eabihf
      - uses: Swatinem/rust-cache@v1
      - uses: actions-rs/cargo@v1
        with:
          command: build
          args: --target thumbv7em-none-eabihf --no-default-features

  fmt:
    name: Rustfmt
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      - uses: Swatinem/rust-cache@v1
      - run: rustup component add rustfmt
      - uses: actions-rs/cargo@v1
        with:
          command: fmt
          args: --all -- --check

  no-std:
    name: no_std compatibility check
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true
      - uses: Swatinem/rust-cache@v1
      - uses: actions-rs/cargo@v1
        with:
          command: check
          args: --no-default-features
      - uses: actions-rs/cargo@v1
        with:
          command: build
          args: --no-default-features
      - uses: actions-rs/cargo@v1
        with:
          command: test
          args: --no-default-features