Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
663ff3db
Commit
663ff3db
authored
5 years ago
by
gabriel klawitter
Committed by
Gavin Wood
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ci: add runtime version check (#555)
parent
1c0cb625
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
polkadot/.gitlab-ci.yml
+28
-0
28 additions, 0 deletions
polkadot/.gitlab-ci.yml
polkadot/scripts/gitlab/check_line_width.sh
+52
-0
52 additions, 0 deletions
polkadot/scripts/gitlab/check_line_width.sh
polkadot/scripts/gitlab/check_runtime.sh
+117
-0
117 additions, 0 deletions
polkadot/scripts/gitlab/check_runtime.sh
with
197 additions
and
0 deletions
polkadot/.gitlab-ci.yml
+
28
−
0
View file @
663ff3db
...
...
@@ -80,6 +80,33 @@ variables:
#### stage: test
check-runtime
:
stage
:
test
image
:
parity/tools:latest
<<
:
*kubernetes-env
only
:
-
/^[0-9]+$/
variables
:
GITLAB_API
:
"
https://gitlab.parity.io/api/v4"
GITHUB_API_PROJECT
:
"
parity%2Finfrastructure%2Fgithub-api"
script
:
-
./scripts/gitlab/check_runtime.sh
allow_failure
:
true
check-line-width
:
stage
:
test
image
:
parity/tools:latest
<<
:
*kubernetes-env
only
:
-
/^[0-9]+$/
script
:
-
./scripts/gitlab/check_line_width.sh
allow_failure
:
true
test-linux-stable
:
&test
...
...
@@ -305,6 +332,7 @@ deploy-polkasync-kusama:
variables
:
GITLAB_API
:
"
https://gitlab.parity.io/api/v4"
GITHUB_API_PROJECT
:
"
parity%2Finfrastructure%2Fparity-testnet"
GIT_STRATEGY
:
none
allow_failure
:
true
script
:
-
|
...
...
This diff is collapsed.
Click to expand it.
polkadot/scripts/gitlab/check_line_width.sh
0 → 100755
+
52
−
0
View file @
663ff3db
#!/bin/sh
#
# check if line width of rust source files is not beyond x characters
#
BASE_BRANCH
=
"origin/master"
LINE_WIDTH
=
"121"
GOOD_LINE_WIDTH
=
"101"
git diff
--name-only
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
\*
.rs |
(
while
read
file
do
if
[
!
-f
${
file
}
]
;
then
echo
"Skipping removed file."
elif
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
|
grep
-q
"^+.
\{
${
LINE_WIDTH
}
\}
"
then
if
[
-z
"
${
FAIL
}
"
]
then
echo
"| warning!"
echo
"| Lines should not be longer than 120 characters."
echo
"| "
echo
"| see more https://wiki.parity.io/Substrate-Style-Guide"
echo
"|"
FAIL
=
"true"
fi
echo
"| file:
${
file
}
"
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
\
|
grep
-n
"^+.
\{
${
LINE_WIDTH
}
\}
"
echo
"|"
else
if
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
|
grep
-q
"^+.
\{
${
GOOD_LINE_WIDTH
}
\}
"
then
if
[
-z
"
${
FAIL
}
"
]
then
echo
"| warning!"
echo
"| Lines should be longer than 100 characters only in exceptional circumstances!"
echo
"| "
echo
"| see more https://wiki.parity.io/Substrate-Style-Guide"
echo
"|"
fi
echo
"| file:
${
file
}
"
git diff
${
BASE_BRANCH
}
...
${
CI_COMMIT_SHA
}
${
file
}
\
|
grep
-n
"^+.
\{
${
LINE_WIDTH
}
\}
"
echo
"|"
fi
fi
done
test
-z
"
${
FAIL
}
"
)
This diff is collapsed.
Click to expand it.
polkadot/scripts/gitlab/check_runtime.sh
0 → 100755
+
117
−
0
View file @
663ff3db
#!/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.
set
-e
# fail on any error
# give some context
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
}
"
curl
-sS
-X
POST
\
-F
"token=
${
CI_JOB_TOKEN
}
"
\
-F
"ref=master"
\
-F
"variables[LABEL]=
${
1
}
"
\
-F
"variables[PRNO]=
${
CI_COMMIT_REF_NAME
}
"
\
-F
"variables[PROJECT]=paritytech/polkadot"
\
${
GITLAB_API
}
/projects/
${
GITHUB_API_PROJECT
}
/trigger/pipeline
}
# 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
}
"
]
then
cat
<<-
EOT
changes to the runtime sources and changes in the impl version.
impl_version:
${
sub_impl_version
}
->
${
add_impl_version
}
EOT
exit
0
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
# drop through into pushing `gotissues` and exit 1...
fi
# dropped through. there's something wrong; exit 1.
exit
1
# vim: noexpandtab
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment