diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml
index 4e8b9b776..96ea5ff89 100644
--- a/.github/actions/build/action.yml
+++ b/.github/actions/build/action.yml
@@ -1,28 +1,19 @@
-name: "Build darwinia node"
+name: "Build Darwinia node"
description: "Darwinia artifacts building action."
inputs:
features:
description: "build features"
+ required: true
+ enable_tar_bz2:
+ description: "enable package tar.bz2"
required: false
- default: ""
+ default: "false"
suffix:
description: "output file suffix"
required: false
default: ""
- enable_cache:
- description: "enable cache"
- required: false
- default: "false"
- cache_shrink_script:
- description: "shrink cache script file path"
- required: false
- default: ".github/shrink-cache.sh"
- enable_tar_bz2:
- description: "enable package tar.bz2"
- required: false
- default: "false"
skip-build:
description: "use this for testing purposes only"
required: false
@@ -38,51 +29,37 @@ runs:
context: .
file: .maintain/docker/ubuntu:20.04.Dockerfile
tags: darwinia-network/build-tool:latest
- - name: Cache cargo
- if: ${{ inputs.enable_cache == 'true' && inputs.skip-build != 'true' }}
- uses: actions/cache@v3
- with:
- path: |
- ./target
- key: darwinia-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-${{ hashFiles('Cargo.lock') }}
- restore-keys: |
- darwinia-${{ runner.os }}-${{ hashFiles('rust-toolchain.toml') }}-
- darwinia-${{ runner.os }}-
+
- name: Build node
shell: bash
run: |
- FEATURES=${{ inputs.features }}
- SUFFIX=${{ inputs.suffix }}
- ENABLE_TAR_BZ2=${{ inputs.enable_tar_bz2 }}
- SKIP_BUILD=${{ inputs.skip-build }}
+ set -euxo pipefail
+
+ FEATURES="${{ inputs.features }}"
+ SUFFIX="${{ inputs.suffix }}"
+ ENABLE_TAR_BZ2="${{ inputs.enable_tar_bz2 }}"
+ SKIP_BUILD="${{ inputs['skip-build'] }}"
+
+ APP_NAME="darwinia"
+ ARCH="x86_64-linux-gnu"
+ OUTPUT_BASENAME="${APP_NAME}${SUFFIX:+-$SUFFIX}-$ARCH"
+ BUILD_DIR="build"
if [ "$SKIP_BUILD" != "true" ]; then
- docker run -i --rm \
- --name=build-darwinia \
- -v=$(pwd):/build \
- darwinia-network/build-tool:latest \
- cargo b --release --locked \
- -p darwinia \
- --features=$FEATURES
+ docker run -i --rm \
+ --name=build-darwinia \
+ -v="$(pwd):/build" \
+ darwinia-network/build-tool:latest \
+ cargo b --release --locked -p darwinia --features="$FEATURES"
else
mkdir -p target/release
echo SKIP_BUILD > target/release/darwinia
fi
- BUILD_DIR=build
- mkdir -p $BUILD_DIR
+ mkdir -p "$BUILD_DIR"
- if [ "$ENABLE_TAR_BZ2" == "true" ]; then
- tar cjSf ${BUILD_DIR}/darwinia${SUFFIX:+-$SUFFIX}-x86_64-linux-gnu.tar.bz2 -C target/release darwinia
+ if [ "$ENABLE_TAR_BZ2" = "true" ]; then
+ tar cjf "$BUILD_DIR/${OUTPUT_BASENAME}.tar.bz2" -C target/release darwinia
fi
- tar cf ${BUILD_DIR}/darwinia${SUFFIX:+-$SUFFIX}-x86_64-linux-gnu.tar.zst -C target/release darwinia -I zstd
- - name: Shrink cache
- if: ${{ inputs.enable_cache == 'true' && inputs.skip-build != 'true' }}
- shell: bash
- run: |
- docker run -i --rm \
- --name=build-darwinia \
- -v=$(pwd):/build \
- darwinia-network/build-tool:latest \
- ${{ inputs.cache_shrink_script }} release
+ tar cf "$BUILD_DIR/${OUTPUT_BASENAME}.tar.zst" -C target/release darwinia -I zstd
diff --git a/.github/note-template/runtime.md b/.github/note-template/runtime.md
index 6fb3515ea..9aea2ebc3 100644
--- a/.github/note-template/runtime.md
+++ b/.github/note-template/runtime.md
@@ -1,11 +1,12 @@
-## {{ .Env.CHAIN | strings.Title }}
-
Upgrade Priority LOW :green_circle:
+## {{ .Env.RUNTIME | strings.Title }}
+Upgrade Priority LOW :green_circle:
-#### Whitelist Hash
+### Digest
+```json
+{{ (ds "prr" | data.ToJSONPretty " ") }}
```
+
+### Whitelist Hash
+```txt
{{ .Env.WHITELIST_HASH }}
```
-#### Blake2 256 Hash
-```
-{{ (ds "srtool").runtimes.compressed.subwasm.blake2_256 }}
-```
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 92fe37d56..79722e084 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -11,12 +11,11 @@ env:
DOCKER_REGISTRY: ghcr.io
- GOMPLATE_VERSION: v3.11.6
+ GOMPLATE_VERSION: v4.3.1
GOMPLATE: gomplate_linux-amd64
GOMPLATE_URL: https://github.com/hairyhenderson/gomplate/releases/download
RUST_BACKTRACE: full
- RUST_TOOLCHAIN: 1.74.0
# Set this to true for CI testing purposes only.
SKIP_BUILD: false
@@ -92,44 +91,56 @@ jobs:
zstd -d wuh.zst
chmod u+x ./wuh
sudo mv ./wuh /usr/bin/wuh
- - name: Build ${{ matrix.runtime }} runtime
- id: srtool_build
- if: ${{ env.SKIP_BUILD != 'true' }}
- uses: chevdor/srtool-actions@v0.9.2
- env:
- BUILD_OPTS: --features=on-chain-release-build
+ - name: Build runtime
+ # It is recommended to use a specific version of the action in production.
+ #
+ # For example:
+ # uses: hack-ink/polkadot-runtime-releaser/action/build@vX.Y.Z
+ uses: hack-ink/polkadot-runtime-releaser/action/build@v0.2.0
with:
- image: paritytech/srtool
- tag: "1.74.0"
- chain: ${{ matrix.runtime }}
+ # The target runtime to build.
+ #
+ # For example, `polkadot-runtime` or `staging-kusama-runtime`.
+ runtime: ${{ matrix.runtime }}-runtime
+ # The features to enable for this release build.
+ #
+ # Generally, this would be `on-chain-release-build` in order to disable the logging to shrink the WASM binary size.
+ features: on-chain-release-build
+ # Rust toolchain version to build the runtime.
+ toolchain-ver: 1.81.0
+ # The workdir to build the runtime.
+ #
+ # By default, it is current directory.
+ # workdir: .
+ # The output directory of the WASM binary.
+ output-dir: .
- name: Prepare runtime
run: |
SKIP_BUILD=${{ env.SKIP_BUILD }}
- export CHAIN=${{ matrix.runtime }}
-
- echo $CHAIN
+ # Template will use this env var.
+ export RUNTIME=${{ matrix.runtime }}
mkdir -p build
if [ "$SKIP_BUILD" == "true" ]; then
- echo SKIP_BUILD > build/${CHAIN}-srtool.json
- echo SKIP_BUILD > build/${CHAIN}_runtime.compact.compressed.wasm
+ echo SKIP_BUILD > build/${RUNTIME}.wasm
echo SKIP_BUILD > build/runtime.md
else
- echo '${{ steps.srtool_build.outputs.json }}' | jq > build/${CHAIN}-srtool.json
-
- WASM_FILE='${{ steps.srtool_build.outputs.wasm_compressed }}'
WHITELIST_PALLET_INDEX=0x33
- if [ "$CHAIN" == "crab" ]; then
+ if [ "$RUNTIME" == "crab" ]; then
WHITELIST_PALLET_INDEX=0x2f
fi
- export WHITELIST_HASH=$(wuh ${WASM_FILE} ${WHITELIST_PALLET_INDEX} 0x01)
+ WASM=$(ls ${RUNTIME}*.wasm)
+ # Template will use this env var.
+ export WHITELIST_HASH=$(wuh ${WASM} ${WHITELIST_PALLET_INDEX} 0x01)
+
+ mv ${WASM} build/
- mv ${WASM_FILE} build/
+ DIGEST=$(ls ${RUNTIME}*.json)
cat .github/note-template/runtime.md \
- | gomplate -d srtool=build/${CHAIN}-srtool.json \
+ | gomplate -d prr=${DIGEST} \
> build/runtime.md
fi
- name: Upload ${{ matrix.runtime }} runtime
@@ -199,7 +210,6 @@ jobs:
- name: Prepare nodes and runtimes
run: |
mkdir -p deploy
- mv *runtime/*.json deploy/
mv *runtime/*.wasm deploy/
mv darwinia/*.tar.* deploy/
mv darwinia-tracing/*.tar.* deploy/