Skip to content

Commit

Permalink
Updated README and added build script for CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mrLSD committed Sep 8, 2023
1 parent b723c31 commit d18c2bb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ jobs:
- name: Preparing rocksdb library
run: scripts/ci/build_rocksdb.sh
- name: Install wasm-opt
run: |
mkdir binaryen
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_110/binaryen-version_110-x86_64-linux.tar.gz | tar -xz -C binaryen
cp binaryen/binaryen-version_110/bin/* /usr/local/bin
rm -rf binaryen
run: scripts/ci/install-wasm-opt.sh
- name: Build contracts
run: cargo make build-contracts
- name: Test contracts
Expand Down Expand Up @@ -61,6 +57,8 @@ jobs:
cache-util restore aurora-engine-target@modexp@${{ hashFiles('**/Cargo.lock') }}:target
- name: Preparing rocksdb library
run: scripts/ci/build_rocksdb.sh
- name: Install wasm-opt
run: scripts/ci/install-wasm-opt.sh
- name: Test mainnet bench-modexp
run: cargo make --profile mainnet bench-modexp
- name: Test testnet bench-modexp
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ documentation.

- Node.js (v14+)
- cargo-make
- wasm-opt (<= v110)

```sh
cargo install --force cargo-make
Expand All @@ -37,6 +38,27 @@ cargo install --force cargo-make
- Node.js (v14+)
- Docker
- cargo-make
- wasm-opt (<= v110)

### Prerequisite wasm-opt

For WebAssembly optimization we use `wasm-opt`.
The supported version of [Binaryen toolchain for WebAssembly](https://github.com/WebAssembly/binaryen)
is `<= v110`. A higher version is not supported.

We recommend installing the release:
https://github.com/WebAssembly/binaryen/releases/tag/version_110

`wasm-opt` command should be available for the build process.

Verify version:

```bash
$ wasm-opt --version
wasm-opt version 110 (version_110)
```

Please keep in mind, that `wasm-opt` runs automatically when you run `cargo make build-*` and `cargo make test` commands.

## Development

Expand Down Expand Up @@ -125,6 +147,20 @@ here:
cargo make check
```

#### Running WebAssembly optimization

In common cases, you don't need to run `wasm-opt` manually, because
it's part of builds and tests.

But for development reasons only you can run:
- `wasm-opt` , runs WebAssembly optimization for pre-build wasm files for specific profile. Requires a
`--profile` argument.

For example, the following will run wasm-opt for pre-build mainnet binary:
```sh
cargo make --profile mainnet wasm-opt
```

#### Cleanup

To clean up the workspace, the following tasks are available:
Expand Down
8 changes: 8 additions & 0 deletions scripts/ci/install-wasm-opt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

if [[ ! -f wasm-opt ]]; then

This comment has been minimized.

Copy link
@aleksuss

aleksuss Sep 8, 2023

Member

I guess this check is redundant cause it always will be true.

mkdir binaryen
curl -L https://github.com/WebAssembly/binaryen/releases/download/version_110/binaryen-version_110-x86_64-linux.tar.gz | tar -xz -C binaryen
cp binaryen/binaryen-version_110/bin/* /usr/local/bin
rm -rf binaryen
fi

0 comments on commit d18c2bb

Please sign in to comment.