Skip to content

Commit

Permalink
Automatically detect the SRTOOL version to use (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
noandrea committed Jun 24, 2024
1 parent 6468865 commit 6a3ee0d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/build-tracing-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,32 @@ ALL_RUNTIMES_NAMES=(
moonriver
moonbeam
)
SRTOOL_IMAGE="paritytech/srtool:1.77.0"


# Arguments
VERSION=$1
RUNTIME_NAME_FILTER=${2:-"[a-z]"}
CARGO_BUILD_JOBS=${3:-"8"}

# Download srtool image
docker pull $SRTOOL_IMAGE

# Copy the needed source code in a temporary folder
mkdir -p tmp/build/tracing
cp -r tracing/${VERSION} tmp/build/tracing/${VERSION}
cp -r tracing/shared tmp/build/tracing/${VERSION}/shared
cd tmp/build/tracing/${VERSION}
chmod -R 777 runtime


# get the toolchain rust version
RUST_VERSION=$(cat rust-toolchain | grep channel | grep --only-matching --perl-regexp "(\d+\.){2}\d+")
# if the version is empty, default to 1.69.0 (that is for runtime before 2300)
if [ -z "$RUST_VERSION" ]; then
RUST_VERSION="1.69.0"
fi
SRTOOL_IMAGE="paritytech/srtool:$RUST_VERSION"

# Download srtool image
docker pull $SRTOOL_IMAGE

for RUNTIME_NAME in ${ALL_RUNTIMES_NAMES[@]}; do
RUNTIME_DIR="runtime/$RUNTIME_NAME"
if [[ "$RUNTIME_NAME" =~ $RUNTIME_NAME_FILTER ]]; then
Expand Down

0 comments on commit 6a3ee0d

Please sign in to comment.