2021-01-28 11:20:20 -08:00
|
|
|
name: Rust
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-12-04 19:40:51 +11:00
|
|
|
branches: [ '**' ]
|
2021-01-28 11:20:20 -08:00
|
|
|
pull_request:
|
2022-12-04 19:40:51 +11:00
|
|
|
branches: [ '**' ]
|
2021-01-28 11:20:20 -08:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
2022-12-08 21:26:18 -07:00
|
|
|
RUSTFLAGS: '-D warnings'
|
2021-01-28 11:20:20 -08:00
|
|
|
|
|
|
|
jobs:
|
2022-11-13 10:17:42 -07:00
|
|
|
test:
|
2021-01-28 11:20:20 -08:00
|
|
|
runs-on: ubuntu-latest
|
2022-11-13 10:17:42 -07:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# 32-bit target
|
|
|
|
- target: i686-unknown-linux-gnu
|
|
|
|
deps: sudo apt update && sudo apt install gcc-multilib
|
2021-01-28 11:20:20 -08:00
|
|
|
|
2022-11-13 10:17:42 -07:00
|
|
|
# 64-bit target
|
|
|
|
- target: x86_64-unknown-linux-gnu
|
2021-01-28 11:20:20 -08:00
|
|
|
steps:
|
2022-11-13 10:17:42 -07:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
- run: rustup target add ${{ matrix.target }}
|
|
|
|
- run: ${{ matrix.deps }}
|
2022-12-08 21:26:18 -07:00
|
|
|
- run: cargo test --target ${{ matrix.target }} --no-default-features
|
2022-12-27 03:12:55 -07:00
|
|
|
- run: cargo test --target ${{ matrix.target }} --no-default-features --features alloc
|
2022-12-26 14:19:55 -07:00
|
|
|
- run: cargo test --target ${{ matrix.target }} --no-default-features --features zeroize
|
2022-11-13 10:17:42 -07:00
|
|
|
- run: cargo test --target ${{ matrix.target }}
|
2022-12-08 21:26:18 -07:00
|
|
|
- run: cargo test --target ${{ matrix.target }} --features serde
|
2022-12-09 01:42:52 -07:00
|
|
|
- env:
|
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_backend="fiat"'
|
|
|
|
run: cargo test --target ${{ matrix.target }}
|
2021-01-28 11:20:20 -08:00
|
|
|
|
2022-12-27 03:13:57 -07:00
|
|
|
build-nostd:
|
|
|
|
name: Build on no_std target (thumbv7em-none-eabi)
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
targets: thumbv7em-none-eabi
|
|
|
|
- run: cargo build --target thumbv7em-none-eabi --release --no-default-features
|
|
|
|
- run: cargo build --target thumbv7em-none-eabi --release
|
|
|
|
- run: cargo build --target thumbv7em-none-eabi --release --features serde
|
|
|
|
|
2022-10-28 13:10:44 -04:00
|
|
|
build-simd:
|
|
|
|
name: Build simd backend (nightly)
|
2021-01-28 11:20:20 -08:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-10-28 12:15:50 -04:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-10-28 13:10:44 -04:00
|
|
|
# Build with AVX2 features, then with AVX512 features
|
|
|
|
- env:
|
2022-12-09 01:42:52 -07:00
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_backend="simd" -C target_feature=+avx2'
|
|
|
|
run: cargo build --target x86_64-unknown-linux-gnu
|
2022-10-28 13:10:44 -04:00
|
|
|
- env:
|
2022-12-09 01:42:52 -07:00
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_backend="simd" -C target_feature=+avx512ifma'
|
|
|
|
run: cargo build --target x86_64-unknown-linux-gnu
|
2021-01-28 11:20:20 -08:00
|
|
|
|
2022-12-10 13:09:24 +11:00
|
|
|
cross:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# ARM32
|
|
|
|
- target: armv7-unknown-linux-gnueabihf
|
|
|
|
rust: stable
|
|
|
|
|
|
|
|
# ARM64
|
|
|
|
- target: aarch64-unknown-linux-gnu
|
|
|
|
rust: stable
|
|
|
|
|
|
|
|
# PPC32
|
|
|
|
- target: powerpc-unknown-linux-gnu
|
|
|
|
rust: stable
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- run: ${{ matrix.deps }}
|
|
|
|
- uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: ${{ matrix.rust }}
|
|
|
|
targets: ${{ matrix.target }}
|
2022-12-27 13:53:12 -07:00
|
|
|
- uses: RustCrypto/actions/cross-install@master
|
2022-12-10 13:09:24 +11:00
|
|
|
- run: cross test --release --target ${{ matrix.target }}
|
|
|
|
|
2021-09-23 21:13:26 +00:00
|
|
|
nightly:
|
|
|
|
name: Test nightly compiler
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-10-28 12:15:50 -04:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-12-09 03:19:53 -05:00
|
|
|
- run: cargo test
|
2021-09-23 21:13:26 +00:00
|
|
|
|
2022-12-04 19:40:51 +11:00
|
|
|
clippy:
|
|
|
|
name: Check that clippy is happy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
|
|
|
with:
|
|
|
|
components: clippy
|
|
|
|
- env:
|
2022-12-09 01:42:52 -07:00
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_backend="simd" -C target_feature=+avx2'
|
|
|
|
run: cargo clippy --target x86_64-unknown-linux-gnu
|
2022-12-04 19:40:51 +11:00
|
|
|
- env:
|
2022-12-09 01:42:52 -07:00
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_backend="simd" -C target_feature=+avx512ifma'
|
|
|
|
run: cargo clippy --target x86_64-unknown-linux-gnu
|
2022-12-04 19:40:51 +11:00
|
|
|
|
|
|
|
rustfmt:
|
|
|
|
name: Check formatting
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
|
|
with:
|
|
|
|
components: rustfmt
|
|
|
|
- run: cargo fmt --all -- --check
|
|
|
|
|
2021-09-23 21:13:26 +00:00
|
|
|
msrv:
|
2022-12-27 03:12:55 -07:00
|
|
|
name: Current MSRV is 1.60.0
|
2021-09-23 21:13:26 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-10-28 12:15:50 -04:00
|
|
|
- uses: actions/checkout@v3
|
2022-10-17 15:08:34 -04:00
|
|
|
# First run `cargo +nightly -Z minimal-verisons check` in order to get a
|
|
|
|
# Cargo.lock with the oldest possible deps
|
2022-10-28 12:15:50 -04:00
|
|
|
- uses: dtolnay/rust-toolchain@nightly
|
2022-12-09 01:42:52 -07:00
|
|
|
- run: cargo -Z minimal-versions check --no-default-features --features serde
|
2022-10-17 15:08:34 -04:00
|
|
|
# Now check that `cargo build` works with respect to the oldest possible
|
|
|
|
# deps and the stated MSRV
|
2022-12-27 03:12:55 -07:00
|
|
|
- uses: dtolnay/rust-toolchain@1.60.0
|
2022-12-09 01:42:52 -07:00
|
|
|
- run: cargo build --no-default-features --features serde
|
2021-09-23 21:13:26 +00:00
|
|
|
|
2021-01-28 11:20:20 -08:00
|
|
|
bench:
|
|
|
|
name: Check that benchmarks compile
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-10-28 12:15:50 -04:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: dtolnay/rust-toolchain@stable
|
2022-12-09 03:52:42 +11:00
|
|
|
- name: Build u32 bench
|
2022-12-09 01:42:52 -07:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_bits="32"'
|
|
|
|
run: cargo build --benches
|
2022-12-09 03:52:42 +11:00
|
|
|
- name: Build u64 bench
|
2022-12-09 01:42:52 -07:00
|
|
|
env:
|
|
|
|
RUSTFLAGS: '--cfg curve25519_dalek_bits="64"'
|
|
|
|
run: cargo build --benches
|
2022-12-09 03:52:42 +11:00
|
|
|
- name: Build default (host native) bench
|
2022-12-08 13:05:59 -07:00
|
|
|
run: cargo build --benches
|