Skip to content

Commit

Permalink
Add release script for ci[skip ci] (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
yrong authored Oct 21, 2021
1 parent a7bece4 commit 60ef2fb
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 7 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}


30 changes: 30 additions & 0 deletions .maintain/publish-release.sh
Original file line number Diff line number Diff line change
@@ -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
32 changes: 26 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
PARA_ID := 2001
DOCKER_TAG := latest
CHAIN := bifrost-local
SURI := //Alice

.PHONY: init
init:
git config core.hooksPath .githooks
Expand Down Expand Up @@ -33,31 +38,31 @@ 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:
cargo check --features "with-all-runtime" --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:
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions resources/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[toolchain]
channel = "nightly-2021-09-12"
components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"]
profile = "minimal"
targets = ["wasm32-unknown-unknown"]
2 changes: 1 addition & 1 deletion xcm-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 60ef2fb

Please sign in to comment.