mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
add test for wasm runtime changes (#1612)
* add test for wasm runtime changes * use default container * disable cache for runtime source test * compare spec_versions directly
This commit is contained in:
committed by
GitHub
parent
822c7ded45
commit
888e7bb76f
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# check for any changes in the node/src/runtime, srml/ and core/sr_* trees. if
|
||||
# there are any changes found, it should mark the PR breaksconsensus and
|
||||
# "auto-fail" the PR in some way unless a) the runtime is rebuilt and b) there
|
||||
# isn't a change in the runtime/src/lib.rs file that alters the version.
|
||||
|
||||
set -e # fail on any error
|
||||
|
||||
# give some context
|
||||
git log --graph --oneline --decorate=short -n 10
|
||||
|
||||
|
||||
RUNTIME="node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm"
|
||||
|
||||
|
||||
|
||||
# check if the wasm sources changed
|
||||
if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
||||
| grep -q -e '^node/src/runtime' -e '^srml/' -e '^core/sr-'
|
||||
then
|
||||
cat <<-EOT
|
||||
|
||||
no changes to the runtime source code detected
|
||||
|
||||
EOT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# check for spec_version updates
|
||||
add_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} node/runtime/src/lib.rs \
|
||||
| sed -n -r 's/^\+[[:space:]]+spec_version: +([0-9]+),$/\1/p')"
|
||||
sub_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} node/runtime/src/lib.rs \
|
||||
| sed -n -r 's/^\-[[:space:]]+spec_version: +([0-9]+),$/\1/p')"
|
||||
|
||||
|
||||
# see if the spec version and the binary blob changed
|
||||
if git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
||||
| grep -q "${RUNTIME}" && \
|
||||
[ "${add_spec_version}" != "${sub_spec_version}" ]
|
||||
then
|
||||
cat <<-EOT
|
||||
|
||||
changes to the runtime sources and changes in the spec version and wasm
|
||||
binary blob.
|
||||
|
||||
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
||||
|
||||
EOT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
wasm source files changed but not the spec version and the runtime
|
||||
binary blob. This may break the api.
|
||||
|
||||
EOT
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
exit 1
|
||||
|
||||
# vim: noexpandtab
|
||||
Reference in New Issue
Block a user