mirror of
https://github.com/logos-blockchain/sponges.git
synced 2026-07-30 02:23:31 +00:00
The new API provides a better way for exposing support for parallel processing in implemented backends and resolves the issue with branching on each application of a Keccak permutation.
181 lines
5.9 KiB
YAML
181 lines
5.9 KiB
YAML
name: keccak
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/keccak.yml"
|
|
- "keccak/**"
|
|
- "Cargo.*"
|
|
push:
|
|
branches: master
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: keccak
|
|
|
|
env:
|
|
RUSTFLAGS: "-Dwarnings"
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
jobs:
|
|
set-msrv:
|
|
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
|
|
with:
|
|
msrv: 1.85.0
|
|
|
|
build:
|
|
needs: set-msrv
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- ${{needs.set-msrv.outputs.msrv}}
|
|
- stable
|
|
target:
|
|
- thumbv7em-none-eabi
|
|
- wasm32-unknown-unknown
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: RustCrypto/actions/cargo-cache@master
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
targets: ${{ matrix.target }}
|
|
- run: cargo build --target ${{ matrix.target }}
|
|
- run: cargo build --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="soft"'
|
|
run: cargo build --target ${{ matrix.target }}
|
|
|
|
minimal-versions:
|
|
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
|
|
with:
|
|
working-directory: ${{ github.workflow }}
|
|
|
|
test:
|
|
needs: set-msrv
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
# AMD64 Linux
|
|
- target: x86_64-unknown-linux-gnu
|
|
platform: ubuntu-latest
|
|
rust: ${{needs.set-msrv.outputs.msrv}}
|
|
- target: x86_64-unknown-linux-gnu
|
|
platform: ubuntu-latest
|
|
rust: stable
|
|
# ARM64 macOS
|
|
- target: aarch64-apple-darwin
|
|
platform: macos-latest
|
|
rust: ${{needs.set-msrv.outputs.msrv}}
|
|
- target: aarch64-apple-darwin
|
|
platform: macos-latest
|
|
rust: stable
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: RustCrypto/actions/cargo-cache@master
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
targets: ${{ matrix.target }}
|
|
- run: cargo check --target ${{ matrix.target }}
|
|
- run: cargo test --target ${{ matrix.target }}
|
|
- run: cargo test --target ${{ matrix.target }} --features parallel
|
|
- run: cargo test --release --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_soft_compact'
|
|
run: cargo test --release --target ${{ matrix.target }}
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="soft"'
|
|
run: cargo test --release --target ${{ matrix.target }}
|
|
- if: contains(matrix.target, 'aarch64')
|
|
env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="aarch64_sha3"'
|
|
run: cargo test --release --target ${{ matrix.target }}
|
|
|
|
test-simd:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: RustCrypto/actions/cargo-cache@master
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd128"'
|
|
run: cargo test --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd256"'
|
|
run: cargo test --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd512"'
|
|
run: cargo test --features parallel
|
|
|
|
test-miri:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
MIRIFLAGS: "-Zmiri-symbolic-alignment-check -Zmiri-strict-provenance"
|
|
strategy:
|
|
matrix:
|
|
target:
|
|
- x86_64-unknown-linux-gnu
|
|
- s390x-unknown-linux-gnu
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: nightly
|
|
components: miri
|
|
- run: cargo miri setup
|
|
- run: cargo miri test --target ${{ matrix.target }}
|
|
- run: cargo miri test --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_soft_compact'
|
|
run: cargo miri test --release --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd128"'
|
|
run: cargo miri test --release --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd256"'
|
|
run: cargo miri test --release --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="simd512"'
|
|
run: cargo miri test --release --target ${{ matrix.target }} --features parallel
|
|
- env:
|
|
RUSTFLAGS: '-Dwarnings --cfg keccak_backend="soft"'
|
|
run: cargo miri test --release --target ${{ matrix.target }} --features parallel
|
|
|
|
aarch64-sha3:
|
|
needs: set-msrv
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
# Cross mounts only current package, i.e. by default it ignores workspace's Cargo.toml
|
|
working-directory: .
|
|
strategy:
|
|
matrix:
|
|
rust:
|
|
- ${{needs.set-msrv.outputs.msrv}}
|
|
- stable
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: RustCrypto/actions/cargo-cache@master
|
|
- uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
targets: aarch64-unknown-linux-gnu
|
|
- name: Install pre-compiled cross
|
|
run: |
|
|
# We need a recent version for RUSTFLAGS to work.
|
|
wget -O /tmp/binaries.tar.gz https://github.com/cross-rs/cross/releases/download/v0.2.4/cross-x86_64-unknown-linux-gnu.tar.gz
|
|
tar -C /tmp -xzf /tmp/binaries.tar.gz
|
|
mv /tmp/cross ~/.cargo/bin
|
|
shell: bash
|
|
- env:
|
|
RUSTFLAGS: '-C target-feature=+sha3 --cfg keccak_backend="aarch64_sha3"'
|
|
run: |
|
|
cd keccak
|
|
# Cross doesn't enable `sha3` by default, but QEMU supports it.
|
|
cross test --target aarch64-unknown-linux-gnu --features parallel
|