Skip to content

Commit

Permalink
fix srtool.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
mclyk committed Sep 21, 2022
1 parent ae1c309 commit 5d672d8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,10 @@ jobs:
echo '${{ secrets.RUNNER_PASSWORD }}' | sudo -S chown -R $USER:$USER $GITHUB_WORKSPACE
echo "HOME=/home/ubuntu" >> ${GITHUB_ENV}
- uses: actions/checkout@v3
- name: Build runtime using "${{ matrix.srtool_image }}:${{ matrix.srtool_image_tag }}"
- name: Srtool build
id: srtool_build
env:
GH_WORKFLOW_MATRIX_CHAIN: ${{ matrix.chain }}
GH_WORKFLOW_MATRIX_SRTOOL_IMAGE: ${{ matrix.srtool_image }}
GH_WORKFLOW_MATRIX_SRTOOL_IMAGE_TAG: ${{ matrix.srtool_image_tag }}
run: |
make wasm
make RUNTIME=${{ matrix.chain }}-runtime wasm
- name: Summary
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json
Expand Down
37 changes: 31 additions & 6 deletions scripts/srtool-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,36 @@ RUSTC_VERSION=1.62.0;
PACKAGE=${PACKAGE:-vanilla-runtime};
BUILD_OPTS=$BUILD_OPTS;

docker run --rm -i \
-e PACKAGE=$PACKAGE \
-e BUILD_OPTS="$BUILD_OPTS" \
-v $PWD:/build \
-v $TMPDIR/cargo:/cargo-home \
CMD="docker run \
-i \
--rm \
-e PACKAGE=${PACKAGE} \
-e BUILD_OPTS="${BUILD_OPTS}" \
-v ${PWD}:/build \
-v ${TMPDIR}/cargo:/cargo-home \
--user root \
--network=host \
paritytech/srtool:$RUSTC_VERSION
paritytech/srtool:${RUSTC_VERSION} \
build --app --json -cM"

stdbuf -oL $CMD | {
while IFS= read -r line
do
echo$line
JSON="$line"
done

echo ::set-output name=json::$JSON

PROP=`echo $JSON | jq -r .runtimes.compact.prop`
echo ::set-output name=proposal_hash::$PROP

WASM=`echo $JSON | jq -r .runtimes.compact.wasm`
echo ::set-output name=wasm::$WASM

Z_WASM=`echo $JSON | jq -r .runtimes.compressed.wasm`
echo ::set-output name=wasm_compressed::$Z_WASM

IPFS=`echo $JSON | jq -r .runtimes.compact.ipfs`
echo ::set-output name=ipfs::$IPFS
}

0 comments on commit 5d672d8

Please sign in to comment.