Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM docker.io/debian:10

MAINTAINER Onur Özkan <onur@komodoplatform.com>
LABEL authors="Onur Özkan <onur@komodoplatform.com>"

RUN apt-get update -y

Expand All @@ -11,6 +11,7 @@ RUN apt-get install -y \
curl \
wget \
unzip \
libudev-dev \
gnupg

RUN ln -s /usr/bin/python3 /bin/python
Expand Down Expand Up @@ -49,8 +50,8 @@ RUN apt-get install -y \
docker-buildx-plugin

RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain nightly-2023-06-01 -y

RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.1/protoc-3.20.1-linux-x86_64.zip
RUN unzip protoc-3.20.1-linux-x86_64.zip && mv ./include/google /usr/include/google

ENV PATH="/root/.cargo/bin:$PATH"
RUN cargo install wasm-pack --version 0.10.3
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v25.3/protoc-25.3-linux-x86_64.zip
RUN unzip protoc-25.3-linux-x86_64.zip && mv ./include/google /usr/include/google

2 changes: 1 addition & 1 deletion .github/workflows/dev-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ jobs:
rustup target add wasm32-unknown-unknown

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | bash -s -- -y
run: CARGO_HOME=/root/.cargo cargo install wasm-pack --version 0.10.3

- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ jobs:
rustup target add wasm32-unknown-unknown

- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | bash -s -- -y
run: CARGO_HOME=/root/.cargo cargo install wasm-pack --version 0.10.3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you pick this version? I see problems with compilation on windows with this specific version.
wasm-bindgen/wasm-pack#1157

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the latest version that is compatible with our toolchain. We shouldn't need to worry about Windows errors as we don't build for Windows.


- name: Calculate commit hash for PR commit
if: github.event_name == 'pull_request'
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ jobs:
deps: ('protoc')

- name: Install wasm-pack
# Use the latest wasm-pack for up-to-date compatibility coverage on KDF.
# As we don't share any build artifacts from this pipeline, we don't need
# to lock the version here.
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh

- name: Download geckodriver
Expand Down
19 changes: 18 additions & 1 deletion docs/WASM_BUILD.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Building WASM binary

## From Container:

If you want to build from source without installing prerequisites to your host system, you can do so by binding the source code inside a container and compiling it there.

Build the image:

```sh
docker build -t kdf-build-container -f .docker/Dockerfile .
```

Bind source code into container and compile it:
```sh
docker run -v "$(pwd)":/app -w /app kdf-build-container wasm-pack build mm2src/mm2_bin_lib --target web --out-dir wasm_build/deps/pkg/
```

## Setting up the environment

To build WASM binary from source, the following prerequisites are required:
Expand Down Expand Up @@ -39,4 +54,6 @@ If you want to disable optimizations to reduce the compilation time, run `wasm-p
wasm-pack build mm2src/mm2_bin_lib --target web --out-dir wasm_build/deps/pkg/ --dev
```

Please don't forget to specify `CC` and `AR` if you run the command on OSX.
Please don't forget to specify `CC` and `AR` if you run the command on OSX.