mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 12:48:00 +00:00
Support both polkadot and kusama runtimes (#704)
* Allow both polkadot and kusama runtimes * Allow both polkadot and kusama runtimes * Make `collator` build * Removed kusama runtime * Introduced common runtime * Updated for latest substrate * Updated CI targets * Updated CI version check * Removed unused dependency * Pulled latests substrate * Pulled latest substrate * Fixed version * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> * NEW_HEADS_IDENTIFIER moved to primitives * Updated CI check script * Fixed script * Set epoch duration for polkadot * ci: check_runtime for both runtimes Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: gabriel klawitter <gabreal@users.noreply.github.com>
This commit is contained in:
committed by
Gavin Wood
parent
9a9bbd1c2d
commit
a00d74d825
@@ -1,10 +1,10 @@
|
||||
#!/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 if there isn't a change in the runtime/src/lib.rs file
|
||||
# that alters the version.
|
||||
# check for any changes in the ^runtime/ tree. if there are any changes found,
|
||||
# it should mark the PR B2-breaksapi and "auto-fail" the PR if there
|
||||
# isn't a change in the runtime/{kusama,polkadot}/src/lib.rs file that alters
|
||||
# the version.
|
||||
|
||||
set -e # fail on any error
|
||||
|
||||
@@ -13,8 +13,6 @@ set -e # fail on any error
|
||||
git log --graph --oneline --decorate=short -n 10
|
||||
|
||||
|
||||
VERSIONS_FILE="runtime/src/lib.rs"
|
||||
|
||||
github_label () {
|
||||
echo
|
||||
echo "# run github-api job for labeling it ${1}"
|
||||
@@ -29,92 +27,90 @@ github_label () {
|
||||
|
||||
|
||||
|
||||
# make sure the master branch is available in shallow clones
|
||||
git fetch --depth=${GIT_DEPTH:-100} origin master
|
||||
|
||||
|
||||
# check if the wasm sources changed
|
||||
if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
||||
| grep -q -e '^runtime/'
|
||||
then
|
||||
cat <<-EOT
|
||||
|
||||
no changes to the runtime source code detected
|
||||
|
||||
EOT
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# check for spec_version updates: if the spec versions changed, then there is
|
||||
# consensus-critical logic that has changed. the runtime wasm blobs must be
|
||||
# rebuilt.
|
||||
|
||||
add_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r "s/^\+[[:space:]]+spec_version: +([0-9]+),$/\1/p")"
|
||||
sub_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r "s/^\-[[:space:]]+spec_version: +([0-9]+),$/\1/p")"
|
||||
|
||||
|
||||
# see if the version and the binary blob changed
|
||||
if [ "${add_spec_version}" != "${sub_spec_version}" ]
|
||||
then
|
||||
|
||||
github_label "B2-breaksapi"
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
changes to the runtime sources and changes in the spec version.
|
||||
|
||||
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
||||
|
||||
EOT
|
||||
exit 0
|
||||
|
||||
else
|
||||
# check for impl_version updates: if only the impl versions changed, we assume
|
||||
# there is no consensus-critical logic that has changed.
|
||||
|
||||
add_impl_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r 's/^\+[[:space:]]+impl_version: +([0-9]+),$/\1/p')"
|
||||
sub_impl_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r 's/^\-[[:space:]]+impl_version: +([0-9]+),$/\1/p')"
|
||||
|
||||
|
||||
# see if the impl version changed
|
||||
if [ "${add_impl_version}" != "${sub_impl_version}" ]
|
||||
for VERSIONS_FILE in runtime/kusama/src/lib.rs runtime/polkadot/src/lib.rs
|
||||
do
|
||||
# check if the wasm sources changed
|
||||
if ! git diff --name-only origin/master...${CI_COMMIT_SHA} \
|
||||
| grep -q -e '^runtime/'
|
||||
then
|
||||
cat <<-EOT
|
||||
|
||||
changes to the runtime sources and changes in the impl version.
|
||||
|
||||
impl_version: ${sub_impl_version} -> ${add_impl_version}
|
||||
|
||||
no changes to the runtime source code detected
|
||||
|
||||
EOT
|
||||
exit 0
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# check for spec_version updates: if the spec versions changed, then there is
|
||||
# consensus-critical logic that has changed. the runtime wasm blobs must be
|
||||
# rebuilt.
|
||||
|
||||
add_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r "s/^\+[[:space:]]+spec_version: +([0-9]+),$/\1/p")"
|
||||
sub_spec_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r "s/^\-[[:space:]]+spec_version: +([0-9]+),$/\1/p")"
|
||||
|
||||
|
||||
# see if the version and the binary blob changed
|
||||
if [ "${add_spec_version}" != "${sub_spec_version}" ]
|
||||
then
|
||||
|
||||
github_label "B2-breaksapi"
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
changes to the runtime sources and changes in the spec version.
|
||||
|
||||
spec_version: ${sub_spec_version} -> ${add_spec_version}
|
||||
|
||||
EOT
|
||||
continue
|
||||
|
||||
else
|
||||
# check for impl_version updates: if only the impl versions changed, we assume
|
||||
# there is no consensus-critical logic that has changed.
|
||||
|
||||
add_impl_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r 's/^\+[[:space:]]+impl_version: +([0-9]+),$/\1/p')"
|
||||
sub_impl_version="$(git diff origin/master...${CI_COMMIT_SHA} ${VERSIONS_FILE} \
|
||||
| sed -n -r 's/^\-[[:space:]]+impl_version: +([0-9]+),$/\1/p')"
|
||||
|
||||
|
||||
# see if the impl version changed
|
||||
if [ "${add_impl_version}" != "${sub_impl_version}" ]
|
||||
then
|
||||
cat <<-EOT
|
||||
|
||||
changes to the runtime sources and changes in the impl version.
|
||||
|
||||
impl_version: ${sub_impl_version} -> ${add_impl_version}
|
||||
|
||||
EOT
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
wasm source files changed but not the spec/impl version and the runtime
|
||||
binary blob. If changes made do not alter logic, just bump 'impl_version'.
|
||||
If they do change logic, bump 'spec_version' and rebuild wasm.
|
||||
|
||||
source file directories:
|
||||
- runtime
|
||||
|
||||
versions file: ${VERSIONS_FILE}
|
||||
|
||||
EOT
|
||||
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
cat <<-EOT
|
||||
|
||||
wasm source files changed but not the spec/impl version and the runtime
|
||||
binary blob. If changes made do not alter logic, just bump 'impl_version'.
|
||||
If they do change logic, bump 'spec_version' and rebuild wasm.
|
||||
|
||||
source file directories:
|
||||
- runtime
|
||||
|
||||
versions file: ${VERSIONS_FILE}
|
||||
|
||||
EOT
|
||||
|
||||
# drop through into pushing `gotissues` and exit 1...
|
||||
fi
|
||||
|
||||
# dropped through. there's something wrong; exit 1.
|
||||
|
||||
exit 1
|
||||
exit 0
|
||||
|
||||
# vim: noexpandtab
|
||||
|
||||
Reference in New Issue
Block a user