Skip to content

Commit

Permalink
Build wasm script (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong committed Aug 6, 2021
1 parent e2e91b4 commit be79dcd
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ polkadot.*
node_modules
yarn.lock
*.log
output
output
deploy
2 changes: 1 addition & 1 deletion scripts/build_image.sh → .maintain/build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [[ -z "$1" ]] ; then
fi

eval $(ssh-agent)
ssh-add ~/.ssh/bifrost_id_rsa
ssh-add ~/.ssh/github_actions
DOCKER_BUILDKIT=1 docker build --ssh default -t "$NODE_NAME:$VERSION" .
docker push "$NODE_NAME:$VERSION"
docker push $NODE_NAME:latest
Expand Down
26 changes: 26 additions & 0 deletions .maintain/build-wasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

set -xe

RUSTC_VERSION="1.53.0"
EXTRA_ARGS='--json'
BIN_PATH=$(dirname $(readlink -f $0))
WORK_PATH=${BIN_PATH}/..
eval $(ssh-agent)
ssh-add ~/.ssh/github_actions

RUNTIME=$1

docker run --rm -it \
-e PACKAGE=$RUNTIME-runtime \
-e VERBOSE=1 \
-e CARGO_TERM_COLOR=always \
-e SSH_AUTH_SOCK=/ssh-agent \
-v $(readlink -f $SSH_AUTH_SOCK):/ssh-agent \
-v ${TMPDIR}/cargo:/cargo-home \
-v ${WORK_PATH}:/build \
paritytech/srtool:${RUSTC_VERSION} build ${EXTRA_ARGS}

mkdir -p ${WORK_PATH}/deploy/wasm
cp ${WORK_PATH}/runtime/$RUNTIME/target/srtool/release/wbuild/$RUNTIME-runtime/${RUNTIME}_runtime.compact.wasm \
${WORK_PATH}/deploy/wasm
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,15 @@ run-dev:
.PHONY: run-dev-manual-seal
run-dev-manual-seal:
RUST_LOG=debug cargo run -p node-cli --locked --features "with-dev-runtime" -- --tmp --dev --sealing instant

.PHONY: build-docker-image
build-docker-image:
.maintain/build-image.sh

.PHONY: build-bifrost-wasm
build-bifrost-wasm:
.maintain/build-wasm.sh bifrost

.PHONY: build-asgard-wasm
build-asgard-wasm:
.maintain/build-wasm.sh asgard

0 comments on commit be79dcd

Please sign in to comment.