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
5d53e529
Commit
5d53e529
authored
2 years ago
by
Chevdor
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add release branch checks (#1319)
parent
e3a2a10e
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cumulus/.github/workflows/release-01_branch-check.yml
+21
-0
21 additions, 0 deletions
cumulus/.github/workflows/release-01_branch-check.yml
cumulus/scripts/ci/github/check-rel-br
+127
-0
127 additions, 0 deletions
cumulus/scripts/ci/github/check-rel-br
with
148 additions
and
0 deletions
cumulus/.github/workflows/release-01_branch-check.yml
0 → 100644
+
21
−
0
View file @
5d53e529
name
:
Release branch check
on
:
push
:
branches
:
-
release-**v[0-9]+.[0-9]+.[0-9]+
# client
-
release-**v[0-9]+
# runtimes
workflow_dispatch
:
jobs
:
tag_rc
:
runs-on
:
ubuntu-latest
steps
:
-
name
:
Checkout sources
uses
:
actions/checkout@v3
with
:
fetch-depth
:
0
-
name
:
Run check
shell
:
bash
run
:
./scripts/ci/github/check-rel-br
This diff is collapsed.
Click to expand it.
cumulus/scripts/ci/github/check-rel-br
0 → 100755
+
127
−
0
View file @
5d53e529
#!/usr/bin/env bash
# This script helps running sanity checks on a release branch
# It is intended to be ran from the repo and from the release branch
# NOTE: The diener runs do take time and are not really required because
# if we missed the diener runs, the Cargo.lock that we check won't pass
# the tests. See https://github.com/bkchr/diener/issues/17
grv
=
$(
git remote
--verbose
|
grep
push
)
export
RUST_LOG
=
none
REPO
=
$(
echo
"
$grv
"
|
cut
-d
' '
-f1
|
cut
-d
$'
\t
'
-f2
|
cut
-d
'/'
-f2
|
cut
-d
'.'
-f1
|
sort
|
uniq
)
echo
"[+] Detected repo:
$REPO
"
BRANCH
=
$(
git branch
--show-current
)
if
!
[[
"
$BRANCH
"
=
~ ^release.
*
$
]]
;
then
echo
"This script is meant to run only on a RELEASE branch."
echo
"Try one of the following branch:"
git branch
-r
--format
"%(refname:short)"
--sort
=
-committerdate
|
grep
-Ei
'/?release'
|
head
exit
1
fi
echo
"[+] Working on
$BRANCH
"
# Tried to get the version of the release from the branch
# input: release-foo-v0.9.22 or release-bar-v9220 or release-foo-v0.9.220
# output: 0.9.22
get_version
()
{
branch
=
$1
[[
$branch
=
~
-v
(
.
*
)
]]
version
=
${
BASH_REMATCH
[1]
}
if
[[
$version
=
~
\.
]]
;
then
MAJOR
=
$((
$(
echo
$version
|
cut
-d
'.'
-f1
)
))
MINOR
=
$((
$(
echo
$version
|
cut
-d
'.'
-f2
)
))
PATCH
=
$((
$(
echo
$version
|
cut
-d
'.'
-f3
)
))
echo
$MAJOR
.
$MINOR
.
${
PATCH
:0:2
}
else
MAJOR
=
$(
echo
$((
$version
/
100000
))
)
remainer
=
$((
$version
-
$MAJOR
*
100000
))
MINOR
=
$(
echo
$((
$remainer
/
1000
))
)
remainer
=
$((
$remainer
-
$MINOR
*
1000
))
PATCH
=
$(
echo
$((
$remainer
/
10
))
)
echo
$MAJOR
.
$MINOR
.
$PATCH
fi
}
# return the name of the release branch for a given repo and version
get_release_branch
()
{
repo
=
$1
version
=
$2
case
$repo
in
polkadot
)
echo
"release-v
$version
"
;;
substrate
)
echo
"polkadot-v
$version
"
;;
*
)
echo
"Repo
$repo
is not supported, exiting"
exit
1
;;
esac
}
# repo = substrate / polkadot
check_release_branch_repo
()
{
repo
=
$1
branch
=
$2
echo
"[+] Checking deps for
$repo
=
$branch
"
POSTIVE
=
$(
cat
Cargo.lock |
grep
"
$repo
?branch=
$branch
"
|
sort
|
uniq
|
wc
-l
)
NEGATIVE
=
$(
cat
Cargo.lock |
grep
"
$repo
?branch="
|
grep
-v
$branch
|
sort
|
uniq
|
wc
-l
)
if
[[
$POSTIVE
-eq
1
&&
$NEGATIVE
-eq
0
]]
;
then
echo
-e
"[+] ✅ Looking good"
cat
Cargo.lock |
grep
"
$repo
?branch="
|
sort
|
uniq
|
sed
's/^/\t - /'
return
0
else
echo
-e
"[+] ❌ Something seems to be wrong, we want 1 unique match and 0 non match (1, 0) and we got (
$((
$POSTIVE
))
,
$((
$NEGATIVE
))
)"
cat
Cargo.lock |
grep
"
$repo
?branch="
|
sort
|
uniq
|
sed
's/^/\t - /'
return
1
fi
}
# Check a release branch
check_release_branches
()
{
SUBSTRATE_BRANCH
=
$1
POLKADOT_BRANCH
=
$2
check_release_branch_repo substrate
$SUBSTRATE_BRANCH
ret_a1
=
$?
ret_b1
=
0
if
[
$POLKADOT_BRANCH
]
;
then
check_release_branch_repo polkadot
$POLKADOT_BRANCH
ret_b1
=
$?
fi
STATUS
=
$((
$ret_a1
+
$ret_b1
))
return
$STATUS
}
VERSION
=
$(
get_version
$BRANCH
)
echo
"[+] Target version: v
$VERSION
"
case
$REPO
in
polkadot
)
substrate
=
$(
get_release_branch substrate
$VERSION
)
check_release_branches
$substrate
;;
cumulus
)
polkadot
=
$(
get_release_branch polkadot
$VERSION
)
substrate
=
$(
get_release_branch substrate
$VERSION
)
check_release_branches
$substrate
$polkadot
;;
*
)
echo
"REPO
$REPO
is not supported, exiting"
exit
1
;;
esac
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