mirror of
https://github.com/vacp2p/zerokit.git
synced 2026-01-09 13:47:58 -05:00
## Changes
- Enabled parallelism in the browser for `rln-wasm` with the
`multithread` feature flag.
- Added browser tests for both single-threaded and multi-threaded modes.
- Enabled browser tests in the CI workflow.
- Pending: resolving hanging issue with `wasm-bindgen-rayon`
([comment](https://github.com/RReverser/wasm-bindgen-rayon/issues/6#issuecomment-2814372940)).
- Forked [this
commit](42887c80e6)
into a separate
[branch](https://github.com/vacp2p/zerokit/tree/benchmark-v0.8.0), which
includes an HTML benchmark file and a test case for the multithreaded
feature in `rln-wasm`.
- The test case still has the known issue above, so it's temporarily
disabled in this PR and will be addressed in the future.
- Improve the `make installdeps` which resolves the issue of NVM not
enabling Node.js in the current terminal session.
- Reduce the build size of the `.wasm` blob using the `wasm-opt` tool
from [Binaryen](https://github.com/WebAssembly/binaryen).
- Maybe we can close this draft
[PR](https://github.com/vacp2p/zerokit/pull/226), which is already very
outdated?
243 lines
7.0 KiB
YAML
243 lines
7.0 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
- "!rln-wasm/**"
|
|
- "!rln/src/**"
|
|
- "!rln/resources/**"
|
|
- "!utils/src/**"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "**.md"
|
|
- "!.github/workflows/*.yml"
|
|
- "!rln-wasm/**"
|
|
- "!rln/src/**"
|
|
- "!rln/resources/**"
|
|
- "!utils/src/**"
|
|
|
|
name: Tests
|
|
|
|
jobs:
|
|
utils-test:
|
|
strategy:
|
|
matrix:
|
|
platform: [ubuntu-latest, macos-latest]
|
|
crate: [utils]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - ${{ matrix.crate }} - ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: cargo-make test
|
|
run: |
|
|
cargo make test --release
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
rln-test:
|
|
strategy:
|
|
matrix:
|
|
platform: [ubuntu-latest, macos-latest]
|
|
crate: [rln]
|
|
feature: ["default", "arkzkey", "stateless"]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - ${{ matrix.crate }} - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install dependencies
|
|
run: make installdeps
|
|
- name: cargo-make test
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make test --release
|
|
else
|
|
cargo make test_${{ matrix.feature }} --release
|
|
fi
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
rln-wasm-test:
|
|
strategy:
|
|
matrix:
|
|
platform: [ubuntu-latest, macos-latest]
|
|
crate: [rln-wasm]
|
|
feature: ["default", "arkzkey"]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: test - ${{ matrix.crate }} - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install Dependencies
|
|
run: make installdeps
|
|
- name: cargo-make build
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make build
|
|
else
|
|
cargo make build_${{ matrix.feature }}
|
|
fi
|
|
working-directory: ${{ matrix.crate }}
|
|
- name: cargo-make test
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make test --release
|
|
else
|
|
cargo make test_${{ matrix.feature }} --release
|
|
fi
|
|
working-directory: ${{ matrix.crate }}
|
|
- name: cargo-make test browser
|
|
run: |
|
|
if [ ${{ matrix.feature }} == default ]; then
|
|
cargo make test_browser --release
|
|
else
|
|
cargo make test_browser_${{ matrix.feature }} --release
|
|
fi
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
# rln-wasm-multihread-test:
|
|
# strategy:
|
|
# matrix:
|
|
# platform: [ubuntu-latest, macos-latest]
|
|
# crate: [rln-wasm]
|
|
# feature: ["multithread", "multithread_arkzkey"]
|
|
# runs-on: ${{ matrix.platform }}
|
|
# timeout-minutes: 60
|
|
|
|
# name: test - ${{ matrix.crate }} - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
# steps:
|
|
# - uses: actions/checkout@v3
|
|
# - name: Install nightly toolchain
|
|
# uses: actions-rs/toolchain@v1
|
|
# with:
|
|
# profile: minimal
|
|
# toolchain: nightly
|
|
# override: true
|
|
# components: rust-src
|
|
# target: wasm32-unknown-unknown
|
|
# - uses: Swatinem/rust-cache@v2
|
|
# - name: Install Dependencies
|
|
# run: make installdeps
|
|
# - name: cargo-make build
|
|
# run: |
|
|
# if [ ${{ matrix.feature }} == default ]; then
|
|
# cargo make build
|
|
# else
|
|
# cargo make build_${{ matrix.feature }}
|
|
# fi
|
|
# working-directory: ${{ matrix.crate }}
|
|
# - name: cargo-make test
|
|
# run: |
|
|
# if [ ${{ matrix.feature }} == default ]; then
|
|
# cargo make test --release
|
|
# else
|
|
# cargo make test_${{ matrix.feature }} --release
|
|
# fi
|
|
# working-directory: ${{ matrix.crate }}
|
|
|
|
lint:
|
|
strategy:
|
|
matrix:
|
|
# we run lint tests only on ubuntu
|
|
platform: [ubuntu-latest]
|
|
crate: [rln, rln-wasm, utils]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: lint - ${{ matrix.crate }} - ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- name: Install stable toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
profile: minimal
|
|
toolchain: stable
|
|
override: true
|
|
components: rustfmt, clippy
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Install Dependencies
|
|
run: make installdeps
|
|
- name: cargo fmt
|
|
if: success() || failure()
|
|
run: cargo fmt -- --check
|
|
working-directory: ${{ matrix.crate }}
|
|
- name: cargo clippy
|
|
if: success() || failure()
|
|
run: |
|
|
cargo clippy --release
|
|
working-directory: ${{ matrix.crate }}
|
|
|
|
benchmark-utils:
|
|
# run only in pull requests
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
matrix:
|
|
# we run benchmark tests only on ubuntu
|
|
platform: [ubuntu-latest]
|
|
crate: [utils]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: benchmark - ${{ matrix.crate }} - ${{ matrix.platform }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: boa-dev/criterion-compare-action@v3
|
|
with:
|
|
branchName: ${{ github.base_ref }}
|
|
cwd: ${{ matrix.crate }}
|
|
|
|
benchmark-rln:
|
|
# run only in pull requests
|
|
if: github.event_name == 'pull_request'
|
|
strategy:
|
|
matrix:
|
|
# we run benchmark tests only on ubuntu
|
|
platform: [ubuntu-latest]
|
|
crate: [rln]
|
|
feature: ["default", "arkzkey"]
|
|
runs-on: ${{ matrix.platform }}
|
|
timeout-minutes: 60
|
|
|
|
name: benchmark - ${{ matrix.crate }} - ${{ matrix.platform }} - ${{ matrix.feature }}
|
|
steps:
|
|
- name: Checkout sources
|
|
uses: actions/checkout@v3
|
|
- uses: Swatinem/rust-cache@v2
|
|
- uses: boa-dev/criterion-compare-action@v3
|
|
with:
|
|
branchName: ${{ github.base_ref }}
|
|
cwd: ${{ matrix.crate }}
|
|
features: ${{ matrix.feature }}
|