Add Wasm build #118
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml | |
on: [push, pull_request] | |
name: Basic | |
jobs: | |
test: | |
name: Build and test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
bls_lib: [zkcrypto, arkworks, arkworks-asm] | |
include: | |
- bls_lib: arkworks-asm | |
rustflags: RUSTFLAGS="-C target-feature=+bmi2,+adx" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.69.0 | |
target: wasm32-unknown-unknown | |
override: true | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --locked --features ${{ matrix.bls_lib }} | |
- name: Build with js feature | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --locked --features ${{ matrix.bls_lib }},js | |
- name: Build Wasm | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --locked --lib --target wasm32-unknown-unknown --features ${{ matrix.bls_lib }} | |
- name: Run unit tests | |
uses: actions-rs/cargo@v1 | |
with: | |
command: test | |
args: --locked --features ${{ matrix.bls_lib }} | |
env: | |
RUST_BACKTRACE: 1 | |
bench: | |
name: Benchmarks | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
bls_lib: [zkcrypto, arkworks, arkworks-asm] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly | |
profile: minimal | |
- name: Set RUSTFLAGS | |
if: ${{ matrix.rustflags }} | |
run: echo ${{ matrix.rustflags }} >> $GITHUB_ENV | |
- name: Run Benchmarks | |
uses: actions-rs/cargo@v1 | |
with: | |
command: bench | |
args: bench_ --no-default-features --features ${{ matrix.bls_lib }} | |
examples: | |
name: Build and run examples | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.69.0 | |
target: wasm32-unknown-unknown | |
override: true | |
- name: Build all | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --examples --locked | |
env: | |
RUST_BACKTRACE: 1 | |
- name: Run example cli | |
# curl -sS https://drand.cloudflare.com/public/72785 | |
run: ./target/debug/examples/drand_verify 72785 a609e19a03c2fcc559e8dae14900aaefe517cb55c840f6e69bc8e4f66c8d18e8a609685d9917efbfb0c37f058c2de88f13d297c7e19e0ab24813079efe57a182554ff054c7638153f9b26a60e7111f71a0ff63d9571704905d3ca6df0b031747 82f5d3d2de4db19d40a6980e8aa37842a0e55d1df06bd68bddc8d60002e8e959eb9cfa368b3c1b77d18f02a54fe047b80f0989315f83b12a74fd8679c4f12aae86eaf6ab5690b34f1fddd50ee3cc6f6cdf59e95526d5a5d82aaa84fa6f181e42 | |
lints: | |
name: Lints | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: 1.69.0 | |
override: true | |
components: rustfmt, clippy | |
- name: Run cargo fmt | |
uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: -- --check | |
- name: Run cargo clippy | |
uses: actions-rs/cargo@v1 | |
with: | |
command: clippy | |
# Cannot use --all-targets because benches require Rust nightly | |
args: --tests --examples -- -D warnings |