diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..85107a857 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release +on: + release: + types: + - published + workflow_dispatch: + inputs: + tag: + description: 'release bifrost' + required: true + +jobs: + build-release: + name: Build binary + runs-on: self-hosted + steps: + - name: Set tag from input + run: | + echo "Tag: ${{ github.event.inputs.tag }}" + echo "TAG=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV" + + - name: Set Tag from release + if: ${{ github.event.release.tag_name }} + run: | + echo "TAG=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV" + + - name: Check to latest commit + uses: actions/checkout@v2 + + - name: Build bifrost + run: | + .maintain/publish-release.sh + + - name: Upload deploy + uses: actions/upload-artifact@v2 + with: + name: bifrost-artifact-${{ github.sha }} + path: | + ./resources/bifrost-wasm.tar.bz2 + ./resources/bifrost-x86_64-linux-gnu.tar.bz2 + + - uses: 8398a7/action-slack@v3 + if: failure() + with: + status: ${{ job.status }} + fields: repo,author,eventName,workflow,ref,commit + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_INCOMING_WEBHOOK_URL }} + + diff --git a/.maintain/publish-release.sh b/.maintain/publish-release.sh new file mode 100755 index 000000000..47d6fdd2e --- /dev/null +++ b/.maintain/publish-release.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -xe + +RUSTC_VERSION="1.53.0" +EXTRA_ARGS='--json' +RUNTIME=bifrost +BIN_PATH=$(dirname $(readlink -f $0)) +WORK_PATH=${BIN_PATH}/../ + +###### build binary +make build-bifrost-release + +cp target/release/bifrost ${WORK_PATH}/resources +chmod +x ${WORK_PATH}/resources/bifrost +tar cjSf ${WORK_PATH}/resources/bifrost-x86_64-linux-gnu.tar.bz2 ${WORK_PATH}/resources/bifrost + + +###### build wasm +docker run --rm -it \ + -e PACKAGE=$RUNTIME-runtime \ + -e VERBOSE=1 \ + -e CARGO_TERM_COLOR=always \ + -v ${TMPDIR}/cargo:/cargo-home \ + -v ${WORK_PATH}:/build \ + paritytech/srtool:${RUSTC_VERSION} build ${EXTRA_ARGS} + +cp ${WORK_PATH}/runtime/$RUNTIME/target/srtool/release/wbuild/$RUNTIME-runtime/${RUNTIME}_runtime.compact.wasm \ +${WORK_PATH}/resources +tar cjSf ${WORK_PATH}/resources/bifrost-wasm.tar.bz2 ${WORK_PATH}/resources/${RUNTIME}_runtime.compact.wasm \ No newline at end of file diff --git a/Makefile b/Makefile index 960ba9a0a..a325ef256 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +PARA_ID := 2001 +DOCKER_TAG := latest +CHAIN := bifrost-local +SURI := //Alice + .PHONY: init init: git config core.hooksPath .githooks @@ -33,15 +38,15 @@ build-all-release: copy-genesis-config-release .PHONY: check-asgard check-asgard: - cargo check -p node-cli --locked --features "with-asgard-runtime" + SKIP_WASM_BUILD= cargo check -p node-cli --locked --features "with-asgard-runtime" .PHONY: check-bifrost check-bifrost: - cargo check -p node-cli --locked --features "with-bifrost-runtime" + SKIP_WASM_BUILD= cargo check -p node-cli --locked --features "with-bifrost-runtime" .PHONY: check-all check-all: format - cargo check -p node-cli --locked --features "with-all-runtime" + SKIP_WASM_BUILD= cargo check -p node-cli --locked --features "with-all-runtime" .PHONY: check-tests check-tests: @@ -49,15 +54,15 @@ check-tests: .PHONY: test-bifrost test-bifrost: - cargo test --features "with-bifrost-runtime" + SKIP_WASM_BUILD= cargo test --features "with-bifrost-runtime" .PHONY: test-asgard test-asgard: - cargo test --features "with-asgard-runtime" + SKIP_WASM_BUILD= cargo test --features "with-asgard-runtime" .PHONY: test-all test-all: - cargo test --features "with-all-runtime" + SKIP_WASM_BUILD= cargo test --features "with-all-runtime" .PHONY: integration-test integration-test: @@ -129,3 +134,18 @@ try-bifrost-runtime-upgrade: .PHONY: try-asgard-runtime-upgrade try-asgard-runtime-upgrade: ./scripts/try-runtime.sh asgard + +.PHONY: resources +resources: + ./target/release/bifrost export-genesis-state --chain $(CHAIN) --parachain-id $(PARA_ID) > ./resources/para-$(PARA_ID)-genesis + ./target/release/bifrost export-genesis-wasm --chain $(CHAIN) > ./resources/para-$(PARA_ID).wasm + ./target/release/bifrost build-spec --chain $(CHAIN) --disable-default-bootnode --raw > ./resources/$(CHAIN)-raw.json + +.PHONY: keystore +keystore: + ./target/release/bifrost key insert --chain $(CHAIN) --keystore-path ./resources/keystore --suri "$(SURI)" --key-type aura + ./target/release/bifrost key insert --chain $(CHAIN) --keystore-path ./resources/keystore --suri "$(SURI)" --key-type gran + +.PHONY: production-release +production-release: + .maintain/publish-release.sh \ No newline at end of file diff --git a/resources/.gitignore b/resources/.gitignore new file mode 100644 index 000000000..86d0cb272 --- /dev/null +++ b/resources/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 000000000..838e46661 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "nightly-2021-09-12" +components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"] +profile = "minimal" +targets = ["wasm32-unknown-unknown"] \ No newline at end of file diff --git a/xcm-support/src/lib.rs b/xcm-support/src/lib.rs index 2ca2dbcac..b7802c4cb 100644 --- a/xcm-support/src/lib.rs +++ b/xcm-support/src/lib.rs @@ -112,7 +112,7 @@ impl< }, DepositAsset { assets: All.into(), - max_assets: u32::max_value(), + max_assets: 1, beneficiary: X1(Junction::AccountId32 { network: NetworkId::Any, id: sovereign_account.into(),