mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Move scripts used in CI to the new location (#1109)
* Move CI scripts to new location * Update references * Update CODEOWNERS file * Update docker/polkadot-collator_builder.Containerfile Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
6ea78e9cc9
commit
dc10d1520d
@@ -0,0 +1,4 @@
|
||||
changelog.md
|
||||
*.json
|
||||
release*.md
|
||||
.env
|
||||
@@ -0,0 +1,21 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
||||
|
||||
gem 'octokit', '~> 4'
|
||||
|
||||
gem 'git_diff_parser', '~> 3'
|
||||
|
||||
gem 'toml', '~> 0.3.0'
|
||||
|
||||
gem 'rake', group: :dev
|
||||
|
||||
gem 'optparse', '~> 0.1.1'
|
||||
|
||||
gem 'logger', '~> 1.4'
|
||||
|
||||
gem 'test-unit', group: :dev
|
||||
|
||||
gem 'rubocop', group: :dev, require: false
|
||||
@@ -0,0 +1,79 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
ast (2.4.2)
|
||||
faraday (1.8.0)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0.1)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.1)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
git_diff_parser (3.2.0)
|
||||
logger (1.4.4)
|
||||
multipart-post (2.1.1)
|
||||
octokit (4.21.0)
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
optparse (0.1.1)
|
||||
parallel (1.21.0)
|
||||
parser (3.0.2.0)
|
||||
ast (~> 2.4.1)
|
||||
parslet (2.0.0)
|
||||
power_assert (2.0.1)
|
||||
public_suffix (4.0.6)
|
||||
rainbow (3.0.0)
|
||||
rake (13.0.6)
|
||||
regexp_parser (2.1.1)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.23.0)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.0.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml
|
||||
rubocop-ast (>= 1.12.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 1.4.0, < 3.0)
|
||||
rubocop-ast (1.13.0)
|
||||
parser (>= 3.0.1.1)
|
||||
ruby-progressbar (1.11.0)
|
||||
ruby2_keywords (0.0.5)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (> 0.8, < 2.0)
|
||||
test-unit (3.5.1)
|
||||
power_assert
|
||||
toml (0.3.0)
|
||||
parslet (>= 1.8.0, < 3.0.0)
|
||||
unicode-display_width (2.1.0)
|
||||
|
||||
PLATFORMS
|
||||
x86_64-darwin-20
|
||||
|
||||
DEPENDENCIES
|
||||
git_diff_parser (~> 3)
|
||||
logger (~> 1.4)
|
||||
octokit (~> 4)
|
||||
optparse (~> 0.1.1)
|
||||
rake
|
||||
rubocop
|
||||
test-unit
|
||||
toml (~> 0.3.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.2.22
|
||||
@@ -0,0 +1,71 @@
|
||||
# Changelog
|
||||
|
||||
Currently, the changelog is built locally. It will be moved to CI once labels stabilize.
|
||||
|
||||
For now, a bit of preparation is required before you can run the script:
|
||||
- fetch the srtool digests
|
||||
- store them under the `digests` folder as `<chain>-srtool-digest.json`
|
||||
- ensure the `.env` file is up to date with correct information
|
||||
|
||||
The content of the release notes is generated from the template files under the `scripts/ci/changelog/templates` folder. For readability and maintenance, the template is split into several small snippets.
|
||||
|
||||
Run:
|
||||
```
|
||||
./bin/changelog <ref_since> [<ref_until>=HEAD]
|
||||
```
|
||||
|
||||
For instance:
|
||||
```
|
||||
./bin/changelog statemine-v5.0.0
|
||||
```
|
||||
|
||||
A file called `release-notes.md` will be generated and can be used for the release.
|
||||
|
||||
## ENV
|
||||
|
||||
You may use the following ENV for testing:
|
||||
|
||||
```
|
||||
RUSTC_STABLE="rustc 1.56.1 (59eed8a2a 2021-11-01)"
|
||||
RUSTC_NIGHTLY="rustc 1.57.0-nightly (51e514c0f 2021-09-12)"
|
||||
PRE_RELEASE=true
|
||||
HIDE_SRTOOL_ROCOCO=true
|
||||
HIDE_SRTOOL_SHELL=true
|
||||
REF1=statemine-v5.0.0
|
||||
REF2=HEAD
|
||||
DEBUG=1
|
||||
NO_CACHE=1
|
||||
```
|
||||
## Considered labels
|
||||
|
||||
The following list will likely evolve over time and it will be hard to keep it in sync.
|
||||
In any case, if you want to find all the labels that are used, search for `meta` in the templates.
|
||||
Currently, the considered labels are:
|
||||
|
||||
- Priority: C<N> labels
|
||||
- Audit: D<N> labels
|
||||
- E4 => new host function
|
||||
- B0 => silent, not showing up
|
||||
- B1-releasenotes (misc unless other labels)
|
||||
- B5-client (client changes)
|
||||
- B7-runtimenoteworthy (runtime changes)
|
||||
- T6-XCM
|
||||
|
||||
Note that labels with the same letter are mutually exclusive.
|
||||
A PR should not have both `B0` and `B5`, or both `C1` and `C9`. In case of conflicts, the template will
|
||||
decide which label will be considered.
|
||||
|
||||
## Dev and debuggin
|
||||
|
||||
### Hot Reload
|
||||
|
||||
The following command allows **Hot Reload**:
|
||||
```
|
||||
fswatch templates -e ".*\.md$" | xargs -n1 -I{} ./bin/changelog statemine-v5.0.0
|
||||
```
|
||||
### Caching
|
||||
|
||||
By default, if the changelog data from Github is already present, the calls to the Github API will be skipped
|
||||
and the local version of the data will be used. This is much faster.
|
||||
If you know that some labels have changed in Github, you probably want to refresh the data.
|
||||
You can then either delete manually the `cumulus.json` file or `export NO_CACHE=1` to force refreshing the data.
|
||||
Executable
+116
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# frozen_string_literal: true
|
||||
|
||||
# call for instance as:
|
||||
# ./bin/changelog statemine-v5.0.0
|
||||
#
|
||||
# You may set the ENV NO_CACHE to force fetching from Github
|
||||
# You should also ensure you set the ENV: GITHUB_TOKEN
|
||||
|
||||
require_relative '../lib/changelog'
|
||||
require 'logger'
|
||||
|
||||
logger = Logger.new($stdout)
|
||||
logger.level = Logger::DEBUG
|
||||
logger.debug('Starting')
|
||||
|
||||
owner = 'paritytech'
|
||||
repo = 'cumulus'
|
||||
ref1 = ARGV[0]
|
||||
ref2 = ARGV[1] || 'HEAD'
|
||||
output = ARGV[2] || 'release-notes.md'
|
||||
|
||||
ENV['REF1'] = ref1
|
||||
ENV['REF2'] = ref2
|
||||
|
||||
gh_cumulus = SubRef.new(format('%<owner>s/%<repo>s', { owner: owner, repo: repo }))
|
||||
|
||||
polkadot_ref1 = gh_cumulus.get_dependency_reference(ref1, 'polkadot-client')
|
||||
polkadot_ref2 = gh_cumulus.get_dependency_reference(ref2, 'polkadot-client')
|
||||
|
||||
substrate_ref1 = gh_cumulus.get_dependency_reference(ref1, 'sp-io')
|
||||
substrate_ref2 = gh_cumulus.get_dependency_reference(ref2, 'sp-io')
|
||||
|
||||
logger.debug("Polkadot from: #{polkadot_ref1}")
|
||||
logger.debug("Polkadot to: #{polkadot_ref2}")
|
||||
|
||||
logger.debug("Substrate from: #{substrate_ref1}")
|
||||
logger.debug("Substrate to: #{substrate_ref2}")
|
||||
|
||||
cumulus_data = 'cumulus.json'
|
||||
substrate_data = 'substrate.json'
|
||||
polkadot_data = 'polkadot.json'
|
||||
|
||||
logger.debug("Using CUMULUS: #{cumulus_data}")
|
||||
logger.debug("Using SUBSTRATE: #{substrate_data}")
|
||||
logger.debug("Using POLKADOT: #{polkadot_data}")
|
||||
|
||||
logger.warn('NO_CACHE set') if ENV['NO_CACHE']
|
||||
|
||||
# This is acting as cache so we don't spend time querying while testing
|
||||
if ENV['NO_CACHE'] || !File.file?(cumulus_data)
|
||||
logger.debug(format('Fetching data for Cumulus into %s', cumulus_data))
|
||||
cmd = format('changelogerator %<owner>s/%<repo>s -f %<from>s -t %<to>s > %<output>s',
|
||||
{ owner: owner, repo: repo, from: ref1, to: ref2, output: cumulus_data })
|
||||
system(cmd)
|
||||
else
|
||||
logger.debug("Re-using:#{cumulus_data}")
|
||||
end
|
||||
|
||||
if ENV['NO_CACHE'] || !File.file?(polkadot_data)
|
||||
logger.debug(format('Fetching data for Polkadot into %s', polkadot_data))
|
||||
cmd = format('changelogerator %<owner>s/%<repo>s -f %<from>s -t %<to>s > %<output>s',
|
||||
{ owner: owner, repo: 'polkadot', from: polkadot_ref1, to: polkadot_ref2, output: polkadot_data })
|
||||
system(cmd)
|
||||
else
|
||||
logger.debug("Re-using:#{polkadot_data}")
|
||||
end
|
||||
|
||||
if ENV['NO_CACHE'] || !File.file?(substrate_data)
|
||||
logger.debug(format('Fetching data for Substrate into %s', substrate_data))
|
||||
cmd = format('changelogerator %<owner>s/%<repo>s -f %<from>s -t %<to>s > %<output>s',
|
||||
{ owner: owner, repo: 'substrate', from: substrate_ref1, to: substrate_ref2, output: substrate_data })
|
||||
system(cmd)
|
||||
else
|
||||
logger.debug("Re-using:#{substrate_data}")
|
||||
end
|
||||
|
||||
SHELL_DIGEST = ENV['SHELL_DIGEST'] || 'digests/shell-srtool-digest.json'
|
||||
WESTMINT_DIGEST = ENV['WESTMINT_DIGEST'] || 'digests/westmint-srtool-digest.json'
|
||||
STATEMINE_DIGEST = ENV['STATEMINE_DIGEST'] || 'digests/statemine-srtool-digest.json'
|
||||
STATEMINT_DIGEST = ENV['STATEMINT_DIGEST'] || 'digests/statemint-srtool-digest.json'
|
||||
ROCOCO_PARA_DIGEST = ENV['ROCOCO_PARA_DIGEST'] || 'digests/rococo-parachain-srtool-digest.json'
|
||||
|
||||
# Here we compose all the pieces together into one
|
||||
# single big json file.
|
||||
cmd = format('jq \
|
||||
--slurpfile cumulus %s \
|
||||
--slurpfile substrate %s \
|
||||
--slurpfile polkadot %s \
|
||||
--slurpfile srtool_shell %s \
|
||||
--slurpfile srtool_westmint %s \
|
||||
--slurpfile srtool_statemine %s \
|
||||
--slurpfile srtool_statemint %s \
|
||||
--slurpfile srtool_rococo_parachain %s \
|
||||
-n \'{
|
||||
cumulus: $cumulus[0],
|
||||
substrate: $substrate[0],
|
||||
polkadot: $polkadot[0],
|
||||
srtool: [
|
||||
{ name: "rococo", data: $srtool_rococo_parachain[0] },
|
||||
{ name: "shell", data: $srtool_shell[0] },
|
||||
{ name: "westmint", data: $srtool_westmint[0] },
|
||||
{ name: "statemint", data: $srtool_statemint[0] },
|
||||
{ name: "statemine", data: $srtool_statemine[0] }
|
||||
] }\' > context.json', cumulus_data, substrate_data, polkadot_data,
|
||||
SHELL_DIGEST,
|
||||
WESTMINT_DIGEST,
|
||||
STATEMINE_DIGEST,
|
||||
STATEMINT_DIGEST,
|
||||
ROCOCO_PARA_DIGEST)
|
||||
system(cmd)
|
||||
|
||||
cmd = format('tera --env --env-key env --include-path templates \
|
||||
--template templates/template.md.tera context.json > %s', output)
|
||||
system(cmd)
|
||||
@@ -0,0 +1 @@
|
||||
*.json
|
||||
@@ -0,0 +1,32 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# A Class to find Substrate references
|
||||
class SubRef
|
||||
require 'octokit'
|
||||
require 'toml'
|
||||
|
||||
attr_reader :client, :repository
|
||||
|
||||
def initialize(github_repo)
|
||||
@client = Octokit::Client.new(
|
||||
access_token: ENV['GITHUB_TOKEN']
|
||||
)
|
||||
@repository = @client.repository(github_repo)
|
||||
end
|
||||
|
||||
# This function checks the Cargo.lock of a given
|
||||
# Rust project, for a given package, and fetches
|
||||
# the dependency git ref.
|
||||
def get_dependency_reference(ref, package)
|
||||
cargo = TOML::Parser.new(
|
||||
Base64.decode64(
|
||||
@client.contents(
|
||||
@repository.full_name,
|
||||
path: 'Cargo.lock',
|
||||
query: { ref: ref.to_s }
|
||||
).content
|
||||
)
|
||||
).parsed
|
||||
cargo['package'].find { |p| p['name'] == package }['source'].split('#').last
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,45 @@
|
||||
{# This macro shows ONE change #}
|
||||
{%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%}
|
||||
|
||||
{%- if c.meta.C and c.meta.C.value >= 7 -%}
|
||||
{%- set prio = " ‼️ HIGH" -%}
|
||||
{%- elif c.meta.C and c.meta.C.value >= 5 -%}
|
||||
{%- set prio = " ❗️ Medium" -%}
|
||||
{%- elif c.meta.C and c.meta.C.value >= 3 -%}
|
||||
{%- set prio = " Low" -%}
|
||||
{%- else -%}
|
||||
{%- set prio = "" -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- set audit = "" -%}
|
||||
{#
|
||||
{%- if c.meta.D and c.meta.D.value == 1 -%}
|
||||
{%- set audit = "✅ audited " -%}
|
||||
{%- elif c.meta.D and c.meta.D.value == 2 -%}
|
||||
{%- set audit = "✅ trivial " -%}
|
||||
{%- elif c.meta.D and c.meta.D.value == 3 -%}
|
||||
{%- set audit = "✅ trivial " -%}
|
||||
{%- elif c.meta.D and c.meta.D.value == 5 -%}
|
||||
{%- set audit = "⏳ pending non-critical audit " -%}
|
||||
{%- else -%}
|
||||
{%- set audit = "" -%}
|
||||
{%- endif -%}
|
||||
#}
|
||||
|
||||
{%- if c.html_url is containing("polkadot") -%}
|
||||
{%- set repo = dot -%}
|
||||
{%- elif c.html_url is containing("cumulus") -%}
|
||||
{%- set repo = cml -%}
|
||||
{%- elif c.html_url is containing("substrate") -%}
|
||||
{%- set repo = sub -%}
|
||||
{%- else -%}
|
||||
{%- set repo = " " -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if c.meta.T and c.meta.T.value == 6 -%}
|
||||
{%- set xcm = " [✉️ XCM]" -%}
|
||||
{%- else -%}
|
||||
{%- set xcm = "" -%}
|
||||
{%- endif -%}
|
||||
{{- repo }} {{ audit }}[`#{{c.number}}`]({{c.html_url}}) {{- prio }} - {{ c.title | capitalize | truncate(length=60, end="…") }}{{xcm }}
|
||||
{%- endmacro change -%}
|
||||
@@ -0,0 +1,14 @@
|
||||
{# This include generates the section showing the changes #}
|
||||
## Changes
|
||||
|
||||
### Legend
|
||||
|
||||
- {{ CML }} Cumulus
|
||||
- {{ DOT }} Polkadot
|
||||
- {{ SUB }} Substrate
|
||||
|
||||
{% include "changes_client.md.tera" %}
|
||||
|
||||
{% include "changes_runtime.md.tera" %}
|
||||
|
||||
{% include "changes_misc.md.tera" %}
|
||||
@@ -0,0 +1,17 @@
|
||||
{% import "change.md.tera" as m_c -%}
|
||||
### Client
|
||||
|
||||
{#- The changes are sorted by merge date #}
|
||||
{%- for pr in changes | sort(attribute="merged_at") %}
|
||||
|
||||
{%- if pr.meta.B %}
|
||||
{%- if pr.meta.B.value == 0 %}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
|
||||
{%- if pr.meta.B.value == 5 and not pr.title is containing("ompanion") %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,39 @@
|
||||
{%- import "change.md.tera" as m_c -%}
|
||||
|
||||
{%- set_global misc_count = 0 -%}
|
||||
{#- First pass to count #}
|
||||
{%- for pr in changes -%}
|
||||
{%- if pr.meta.B %}
|
||||
{%- if pr.meta.B.value == 0 -%}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 and pr.meta.B.value != 7 or pr.meta.C or not pr.meta.B %}
|
||||
{%- set_global misc_count = misc_count + 1 -%}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
|
||||
### Misc
|
||||
|
||||
{% if misc_count > 10 %}
|
||||
There are other misc. changes. You can expand the list below to view them all.
|
||||
<details><summary>Other misc. changes</summary>
|
||||
{% endif -%}
|
||||
|
||||
{#- The changes are sorted by merge date #}
|
||||
{%- for pr in changes | sort(attribute="merged_at") %}
|
||||
{%- if pr.meta.B and not pr.title is containing("ompanion") %}
|
||||
{%- if pr.meta.B.value == 0 %}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.B and pr.meta.B.value != 5 and pr.meta.B.value != 7 or pr.meta.C or not pr.meta.B %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- endif -%}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endfor %}
|
||||
|
||||
{% if misc_count > 10 %}
|
||||
</details>
|
||||
{% endif -%}
|
||||
@@ -0,0 +1,19 @@
|
||||
{%- import "change.md.tera" as m_c -%}
|
||||
|
||||
### Runtime
|
||||
|
||||
{#- The changes are sorted by merge date -#}
|
||||
{% for pr in changes | sort(attribute="merged_at") -%}
|
||||
|
||||
{%- if pr.meta.B -%}
|
||||
{%- if pr.meta.B.value == 0 -%}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
|
||||
{%- if pr.meta.B.value == 7 and not pr.title is containing("ompanion") %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
@@ -0,0 +1,6 @@
|
||||
## Rust compiler versions
|
||||
|
||||
This release was tested against the following versions of `rustc`. Other versions may work.
|
||||
|
||||
- Rust Stable: `{{ env.RUSTC_STABLE }}`
|
||||
- Rust Nightly: `{{ env.RUSTC_NIGHTLY }}`
|
||||
@@ -0,0 +1,10 @@
|
||||
{%- set to_ignore = changes | filter(attribute="meta.B.value", value=0) %}
|
||||
|
||||
<!--
|
||||
## Debug
|
||||
|
||||
changes:
|
||||
- total: {{ changes | length }}
|
||||
- silent: {{ to_ignore | length }}
|
||||
- remaining: {{ changes | length - to_ignore | length }}
|
||||
-->
|
||||
@@ -0,0 +1,11 @@
|
||||
<!--
|
||||
## Docker images
|
||||
|
||||
The docker image for this release can be found in [Docker hub](https://hub.docker.com/r/parity/polkadot-collator/tags?page=1&ordering=last_updated).
|
||||
|
||||
You may also pull it with:
|
||||
|
||||
```
|
||||
docker pull parity/polkadot-collator:latest
|
||||
```
|
||||
-->
|
||||
@@ -0,0 +1,37 @@
|
||||
{% import "high_priority.md.tera" as m_p -%}
|
||||
## Global Priority
|
||||
|
||||
{%- set cumulus_prio = 0 -%}
|
||||
{%- set polkadot_prio = 0 -%}
|
||||
{%- set substrate_prio = 0 -%}
|
||||
|
||||
{# We fetch the various priorities #}
|
||||
{%- if cumulus.meta.C -%}
|
||||
{%- set cumulus_prio = cumulus.meta.C.max -%}
|
||||
{%- endif -%}
|
||||
{%- if polkadot.meta.C -%}
|
||||
{%- set polkadot_prio = polkadot.meta.C.max -%}
|
||||
{%- endif -%}
|
||||
{%- if substrate.meta.C -%}
|
||||
{%- set substrate_prio = substrate.meta.C.max -%}
|
||||
{%- endif -%}
|
||||
|
||||
{# We compute the global priority #}
|
||||
{%- set global_prio = cumulus_prio -%}
|
||||
{%- if polkadot_prio > global_prio -%}
|
||||
{% set global_prio = polkadot_prio -%}
|
||||
{%- endif -%}
|
||||
{%- if substrate_prio > global_prio -%}
|
||||
{%- set global_prio = substrate_prio -%}
|
||||
{%- endif -%}
|
||||
|
||||
{# We show the result #}
|
||||
{{ m_p::high_priority(p=global_prio, changes=changes) }}
|
||||
|
||||
<!--
|
||||
- Cumulus: {{ cumulus_prio }}
|
||||
- Polkadot: {{ polkadot_prio }}
|
||||
- Substrate: {{ substrate_prio }}
|
||||
-->
|
||||
|
||||
{# todo: show high prio list here #}
|
||||
@@ -0,0 +1,37 @@
|
||||
{%- import "change.md.tera" as m_c -%}
|
||||
|
||||
{# This macro convert a priority level into readable output #}
|
||||
{%- macro high_priority(p, changes) -%}
|
||||
|
||||
{%- if p >= 7 -%}
|
||||
{%- set prio = "‼️ HIGH" -%}
|
||||
{%- set text = "This is a **high priority** release and you must upgrade as as soon as possible." -%}
|
||||
{%- elif p >= 5 -%}
|
||||
{%- set prio = "❗️ Medium" -%}
|
||||
{%- set text = "This is a medium priority release and you should upgrade in a timely manner." -%}
|
||||
{%- elif p >= 3 -%}
|
||||
{%- set prio = "Low" -%}
|
||||
{%- set text = "This is a low priority release and you may upgrade at your convenience." -%}
|
||||
{%- endif %}
|
||||
|
||||
{%- if prio %}
|
||||
{{prio}}: {{text}}
|
||||
{%- else -%}
|
||||
<!-- No relevant Priority label as been detected -->
|
||||
{% endif %}
|
||||
|
||||
The changes motivating this priority level are:
|
||||
|
||||
{% for pr in changes | sort(attribute="merged_at") -%}
|
||||
{%- if pr.meta.C -%}
|
||||
{%- if pr.meta.C.value == p %}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{%- if pr.meta.B and pr.meta.B.value == 7 %}
|
||||
(RUNTIME)
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
{%- endfor %}
|
||||
|
||||
|
||||
{%- endmacro priority -%}
|
||||
@@ -0,0 +1,30 @@
|
||||
{%- import "change.md.tera" as m_c -%}
|
||||
{%- set_global host_fn_count = 0 -%}
|
||||
|
||||
{% for pr in changes | sort(attribute="merged_at") -%}
|
||||
|
||||
{%- if pr.meta.B and pr.meta.B.value == 0 -%}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.E and pr.meta.E.value == 4 -%}
|
||||
{%- set_global host_fn_count = host_fn_count + 1 -%}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{%- endfor -%}
|
||||
|
||||
<!-- {{ host_fn_count }} host functions were detected -->
|
||||
|
||||
{% if host_fn_count == 0 -%}
|
||||
<!-- ℹ️ This release does not contain any new host functions. -->
|
||||
{% elif host_fn_count == 1 -%}
|
||||
## Host functions
|
||||
|
||||
⚠️ The runtimes in this release contain one new **host function**.
|
||||
|
||||
⚠️ It is critical that you update your client before the chain switches to the new runtimes.
|
||||
{%- else -%}
|
||||
⚠️ The runtimes in this release contain {{ host_fn_count }} new **host function{{ host_fn_count | pluralize }}**.
|
||||
|
||||
⚠️ It is critical that you update your client before the chain switches to the new runtimes.
|
||||
{%- endif %}
|
||||
@@ -0,0 +1,14 @@
|
||||
{%- import "change.md.tera" as m_c %}
|
||||
|
||||
## Migrations
|
||||
|
||||
{% for pr in changes | sort(attribute="merged_at") -%}
|
||||
|
||||
{%- if pr.meta.B and pr.meta.B.value == 0 %}
|
||||
{#- We skip silent ones -#}
|
||||
{%- else -%}
|
||||
{%- if pr.meta.E and pr.meta.E.value == 1 -%}
|
||||
- {{ m_c::change(c=pr) }}
|
||||
{% endif -%}
|
||||
{% endif -%}
|
||||
{% endfor -%}
|
||||
@@ -0,0 +1,11 @@
|
||||
{%- if env.PRE_RELEASE == "true" -%}
|
||||
<details><summary>⚠️ This is a pre-release</summary>
|
||||
|
||||
**Release candidates** are **pre-releases** may not be final.
|
||||
Although they are reasonably tested, there may be additional changes or issues
|
||||
before an official release is tagged. Use at your own discretion, and consider
|
||||
only using published releases on critical production infrastructure.
|
||||
</details>
|
||||
{% else -%}
|
||||
<!-- NOT a pre-release-->
|
||||
{%- endif %}
|
||||
@@ -0,0 +1,28 @@
|
||||
{# This macro shows one runtime #}
|
||||
{%- macro runtime(runtime) -%}
|
||||
|
||||
### {{ runtime.name | capitalize }}
|
||||
|
||||
{%- if runtime.data.runtimes.compressed.subwasm.compression.compressed %}
|
||||
{%- set compressed = "Yes" %}
|
||||
{%- else %}
|
||||
{%- set compressed = "No" %}
|
||||
{%- endif %}
|
||||
|
||||
{%- set comp_ratio = 100 - (runtime.data.runtimes.compressed.subwasm.compression.size_compressed / runtime.data.runtimes.compressed.subwasm.compression.size_decompressed *100) %}
|
||||
<!-- commit : {{ runtime.data.commit }} -->
|
||||
<!-- tag : {{ runtime.data.tag }} -->
|
||||
<!-- branch : {{ runtime.data.branch }} -->
|
||||
<!-- pkg : {{ runtime.data.pkg }} -->
|
||||
|
||||
```
|
||||
🏋️ Runtime Size: {{ runtime.data.runtimes.compressed.subwasm.size | filesizeformat }} ({{ runtime.data.runtimes.compressed.subwasm.size }} bytes)
|
||||
🔥 Core Version: {{ runtime.data.runtimes.compressed.subwasm.core_version }}
|
||||
🗜 Compressed: {{ compressed }}: {{ comp_ratio | round(method="ceil", precision=2) }}%
|
||||
🎁 Metadata version: V{{ runtime.data.runtimes.compressed.subwasm.metadata_version }}
|
||||
🗳️ system.setCode hash: {{ runtime.data.runtimes.compressed.subwasm.proposal_hash }}
|
||||
🗳️ authorizeUpgrade hash: {{ runtime.data.runtimes.compressed.subwasm.parachain_authorize_upgrade_hash }}
|
||||
#️⃣ Blake2-256 hash: {{ runtime.data.runtimes.compressed.subwasm.blake2_256 }}
|
||||
📦 IPFS: {{ runtime.data.runtimes.compressed.subwasm.ipfs_hash }}
|
||||
```
|
||||
{%- endmacro runtime %}
|
||||
@@ -0,0 +1,17 @@
|
||||
{# This include shows the list and details of the runtimes #}
|
||||
{%- import "runtime.md.tera" as m_r -%}
|
||||
|
||||
## Runtimes
|
||||
|
||||
{% set rtm = srtool[0] -%}
|
||||
|
||||
The information about the runtimes included in this release can be found below.
|
||||
The runtimes have been built using [{{ rtm.data.gen }}](https://github.com/paritytech/srtool) and `{{ rtm.data.rustc }}`.
|
||||
|
||||
{%- for runtime in srtool | sort(attribute="name") %}
|
||||
{%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %}
|
||||
{%- if not env is containing(HIDE_VAR) %}
|
||||
|
||||
{{ m_r::runtime(runtime=runtime) }}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
@@ -0,0 +1,32 @@
|
||||
{# This is the entry point of the template -#}
|
||||
<!-- repository: {{ cumulus.repository.name }} -->
|
||||
{% include "pre_release.md.tera" -%}
|
||||
|
||||
{% if env.PRE_RELEASE == "true" -%}
|
||||
This pre-release contains the changes from `{{ env.REF1 }}` to `{{ env.REF2 }}`.
|
||||
{% else -%}
|
||||
This release contains the changes from `{{ env.REF1 }}` to `{{ env.REF2 }}`.
|
||||
{% endif -%}
|
||||
|
||||
{%- set changes = cumulus.changes | concat(with=substrate.changes) -%}
|
||||
{%- set changes = changes | concat(with=polkadot.changes) -%}
|
||||
{%- include "debug.md.tera" -%}
|
||||
|
||||
{%- set CML = "[C]" -%}
|
||||
{%- set DOT = "[P]" -%}
|
||||
{%- set SUB = "[S]" -%}
|
||||
|
||||
|
||||
{% include "global_priority.md.tera" -%}
|
||||
|
||||
{% include "host_functions.md.tera" -%}
|
||||
|
||||
{% include "compiler.md.tera" -%}
|
||||
|
||||
{% include "migrations.md.tera" -%}
|
||||
|
||||
{% include "runtimes.md.tera" -%}
|
||||
|
||||
{% include "changes.md.tera" -%}
|
||||
|
||||
{% include "docker_image.md.tera" -%}
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require_relative '../lib/changelog'
|
||||
require 'test/unit'
|
||||
|
||||
class TestChangelog < Test::Unit::TestCase
|
||||
def test_get_dep_ref_polkadot
|
||||
c = SubRef.new('paritytech/polkadot')
|
||||
ref = '13c2695'
|
||||
package = 'sc-cli'
|
||||
result = c.get_dependency_reference(ref, package)
|
||||
assert_equal('7db0768a85dc36a3f2a44d042b32f3715c00a90d', result)
|
||||
end
|
||||
|
||||
def test_get_dep_ref_invalid_ref
|
||||
c = SubRef.new('paritytech/polkadot')
|
||||
ref = '9999999'
|
||||
package = 'sc-cli'
|
||||
assert_raise do
|
||||
c.get_dependency_reference(ref, package)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,141 @@
|
||||
#!/bin/sh
|
||||
|
||||
api_base="https://api.github.com/repos"
|
||||
|
||||
# Function to take 2 git tags/commits and get any lines from commit messages
|
||||
# that contain something that looks like a PR reference: e.g., (#1234)
|
||||
sanitised_git_logs(){
|
||||
git --no-pager log --pretty=format:"%s" "$1...$2" |
|
||||
# Only find messages referencing a PR
|
||||
grep -E '\(#[0-9]+\)' |
|
||||
# Strip any asterisks
|
||||
sed 's/^* //g'
|
||||
}
|
||||
|
||||
# Checks whether a tag on github has been verified
|
||||
# repo: 'organization/repo'
|
||||
# tagver: 'v1.2.3'
|
||||
# Usage: check_tag $repo $tagver
|
||||
check_tag () {
|
||||
repo=$1
|
||||
tagver=$2
|
||||
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
||||
echo '[+] Fetching tag using privileged token'
|
||||
tag_out=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$api_base/$repo/git/refs/tags/$tagver")
|
||||
else
|
||||
echo '[+] Fetching tag using unprivileged token'
|
||||
tag_out=$(curl -H "Authorization: token $GITHUB_PR_TOKEN" -s "$api_base/$repo/git/refs/tags/$tagver")
|
||||
fi
|
||||
tag_sha=$(echo "$tag_out" | jq -r .object.sha)
|
||||
object_url=$(echo "$tag_out" | jq -r .object.url)
|
||||
if [ "$tag_sha" = "null" ]; then
|
||||
return 2
|
||||
fi
|
||||
echo "[+] Tag object SHA: $tag_sha"
|
||||
verified_str=$(curl -H "Authorization: token $GITHUB_RELEASE_TOKEN" -s "$object_url" | jq -r .verification.verified)
|
||||
if [ "$verified_str" = "true" ]; then
|
||||
# Verified, everything is good
|
||||
return 0
|
||||
else
|
||||
# Not verified. Bad juju.
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether a given PR has a given label.
|
||||
# repo: 'organization/repo'
|
||||
# pr_id: 12345
|
||||
# label: B1-silent
|
||||
# Usage: has_label $repo $pr_id $label
|
||||
has_label(){
|
||||
repo="$1"
|
||||
pr_id="$2"
|
||||
label="$3"
|
||||
|
||||
# These will exist if the function is called in Gitlab.
|
||||
# If the function's called in Github, we should have GITHUB_ACCESS_TOKEN set
|
||||
# already.
|
||||
if [ -n "$GITHUB_RELEASE_TOKEN" ]; then
|
||||
GITHUB_TOKEN="$GITHUB_RELEASE_TOKEN"
|
||||
elif [ -n "$GITHUB_PR_TOKEN" ]; then
|
||||
GITHUB_TOKEN="$GITHUB_PR_TOKEN"
|
||||
fi
|
||||
|
||||
out=$(curl -H "Authorization: token $GITHUB_TOKEN" -s "$api_base/$repo/pulls/$pr_id")
|
||||
[ -n "$(echo "$out" | tr -d '\r\n' | jq ".labels | .[] | select(.name==\"$label\")")" ]
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
# Formats a message into a JSON string for posting to Matrix
|
||||
# message: 'any plaintext message'
|
||||
# formatted_message: '<strong>optional message formatted in <em>html</em></strong>'
|
||||
# Usage: structure_message $content $formatted_content (optional)
|
||||
structure_message() {
|
||||
if [ -z "$2" ]; then
|
||||
body=$(jq -Rs --arg body "$1" '{"msgtype": "m.text", $body}' < /dev/null)
|
||||
else
|
||||
body=$(jq -Rs --arg body "$1" --arg formatted_body "$2" '{"msgtype": "m.text", $body, "format": "org.matrix.custom.html", $formatted_body}' < /dev/null)
|
||||
fi
|
||||
echo "$body"
|
||||
}
|
||||
|
||||
# Post a message to a matrix room
|
||||
# body: '{body: "JSON string produced by structure_message"}'
|
||||
# room_id: !fsfSRjgjBWEWffws:matrix.parity.io
|
||||
# access_token: see https://matrix.org/docs/guides/client-server-api/
|
||||
# Usage: send_message $body (json formatted) $room_id $access_token
|
||||
send_message() {
|
||||
curl -XPOST -d "$1" "https://matrix.parity.io/_matrix/client/r0/rooms/$2/send/m.room.message?access_token=$3"
|
||||
}
|
||||
|
||||
# Pretty-printing functions
|
||||
boldprint () { printf "|\n| \033[1m%s\033[0m\n|\n" "${@}"; }
|
||||
boldcat () { printf "|\n"; while read -r l; do printf "| \033[1m%s\033[0m\n" "${l}"; done; printf "|\n" ; }
|
||||
|
||||
skip_if_companion_pr() {
|
||||
url="https://api.github.com/repos/paritytech/polkadot/pulls/${CI_COMMIT_REF_NAME}"
|
||||
echo "[+] API URL: $url"
|
||||
|
||||
pr_title=$(curl -sSL -H "Authorization: token ${GITHUB_PR_TOKEN}" "$url" | jq -r .title)
|
||||
echo "[+] PR title: $pr_title"
|
||||
|
||||
if echo "$pr_title" | grep -qi '^companion'; then
|
||||
echo "[!] PR is a companion PR. Build is already done in substrate"
|
||||
exit 0
|
||||
else
|
||||
echo "[+] PR is not a companion PR. Proceeding test"
|
||||
fi
|
||||
}
|
||||
|
||||
# Fetches the tag name of the latest release from a repository
|
||||
# repo: 'organisation/repo'
|
||||
# Usage: latest_release 'paritytech/polkadot'
|
||||
latest_release() {
|
||||
curl -s "$api_base/$1/releases/latest" | jq -r '.tag_name'
|
||||
}
|
||||
|
||||
# Check for runtime changes between two commits. This is defined as any changes
|
||||
# to /primitives/src/* and any *production* chains under /runtime
|
||||
has_runtime_changes() {
|
||||
from=$1
|
||||
to=$2
|
||||
|
||||
if git diff --name-only "${from}...${to}" \
|
||||
| grep -q -e '^runtime/polkadot' -e '^runtime/kusama' -e '^primitives/src/' -e '^runtime/common'
|
||||
then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
Executable
+55
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
# This script is used in a Github Workflow. It helps filtering out what is interesting
|
||||
# when comparing metadata and spot what would require a tx version bump.
|
||||
|
||||
# shellcheck disable=SC2002,SC2086
|
||||
|
||||
FILE=$1
|
||||
|
||||
# Higlight indexes that were deleted
|
||||
function find_deletions() {
|
||||
echo "\n## Deletions\n"
|
||||
RES=$(cat "$FILE" | grep -n '\[\-\]' | tr -s " ")
|
||||
if [ "$RES" ]; then
|
||||
echo "$RES" | awk '{ printf "%s\\n", $0 }'
|
||||
else
|
||||
echo "n/a"
|
||||
fi
|
||||
}
|
||||
|
||||
# Highlight indexes that have been deleted
|
||||
function find_index_changes() {
|
||||
echo "\n## Index changes\n"
|
||||
RES=$(cat "$FILE" | grep -E -n -i 'idx:\s*([0-9]+)\s*(->)\s*([0-9]+)' | tr -s " ")
|
||||
if [ "$RES" ]; then
|
||||
echo "$RES" | awk '{ printf "%s\\n", $0 }'
|
||||
else
|
||||
echo "n/a"
|
||||
fi
|
||||
}
|
||||
|
||||
# Highlight values that decreased
|
||||
function find_decreases() {
|
||||
echo "\n## Decreases\n"
|
||||
OUT=$(cat "$FILE" | grep -E -i -o '([0-9]+)\s*(->)\s*([0-9]+)' | awk '$1 > $3 { printf "%s;", $0 }')
|
||||
IFS=$';' LIST=("$OUT")
|
||||
unset RES
|
||||
for line in "${LIST[@]}"; do
|
||||
RES="$RES\n$(cat "$FILE" | grep -E -i -n \"$line\" | tr -s " ")"
|
||||
done
|
||||
|
||||
if [ "$RES" ]; then
|
||||
echo "$RES" | awk '{ printf "%s\\n", $0 }' | sort -u -g | uniq
|
||||
else
|
||||
echo "n/a"
|
||||
fi
|
||||
}
|
||||
|
||||
echo "\n------------------------------ SUMMARY -------------------------------"
|
||||
echo "\n⚠️ This filter is here to help spotting changes that should be reviewed carefully."
|
||||
echo "\n⚠️ It catches only index changes, deletions and value decreases".
|
||||
|
||||
find_deletions "$FILE"
|
||||
find_index_changes "$FILE"
|
||||
find_decreases "$FILE"
|
||||
echo "\n----------------------------------------------------------------------\n"
|
||||
Executable
+75
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#shellcheck source=../common/lib.sh
|
||||
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/../common/lib.sh"
|
||||
|
||||
repo="$GITHUB_REPOSITORY"
|
||||
pr="$GITHUB_PR"
|
||||
|
||||
ensure_labels() {
|
||||
for label in "$@"; do
|
||||
if has_label "$repo" "$pr" "$label"; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Must have one of the following labels
|
||||
releasenotes_labels=(
|
||||
'B0-silent'
|
||||
'B1-releasenotes'
|
||||
'B7-runtimenoteworthy'
|
||||
)
|
||||
|
||||
# Must be an ordered list of priorities, lowest first
|
||||
priority_labels=(
|
||||
'C1-low 📌'
|
||||
'C3-medium 📣'
|
||||
'C7-high ❗️'
|
||||
'C9-critical ‼️'
|
||||
)
|
||||
|
||||
audit_labels=(
|
||||
'D1-audited 👍'
|
||||
'D2-notlive 💤'
|
||||
'D3-trivial 🧸'
|
||||
'D5-nicetohaveaudit ⚠️'
|
||||
'D9-needsaudit 👮'
|
||||
)
|
||||
|
||||
echo "[+] Checking release notes (B) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${releasenotes_labels[@]}"; then
|
||||
echo "[+] Release notes label detected. All is well."
|
||||
else
|
||||
echo "[!] Release notes label not detected. Please add one of: ${releasenotes_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[+] Checking release priority (C) labels for $CI_COMMIT_BRANCH"
|
||||
if ensure_labels "${priority_labels[@]}"; then
|
||||
echo "[+] Release priority label detected. All is well."
|
||||
else
|
||||
echo "[!] Release priority label not detected. Please add one of: ${priority_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if has_runtime_changes "${BASE_SHA}" "${HEAD_SHA}"; then
|
||||
echo "[+] Runtime changes detected. Checking audit (D) labels"
|
||||
if ensure_labels "${audit_labels[@]}"; then
|
||||
echo "[+] Release audit label detected. All is well."
|
||||
else
|
||||
echo "[!] Release audit label not detected. Please add one of: ${audit_labels[*]}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If the priority is anything other than the lowest, we *must not* have a B0-silent
|
||||
# label
|
||||
if has_label "$repo" "$GITHUB_PR" 'B0-silent' &&
|
||||
! has_label "$repo" "$GITHUB_PR" "${priority_labels[0]}"; then
|
||||
echo "[!] Changes with a priority higher than C1-low *MUST* have a B- label that is not B0-Silent"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Gets the runtime version for a given runtime from the filesystem.
|
||||
# Optionally accepts a path that is the root of the project which defaults to
|
||||
# the current working directory
|
||||
def get_runtime(runtime: nil, path: '.', runtime_dir: 'runtime')
|
||||
File.open(path + "/#{runtime_dir}/#{runtime}/src/lib.rs") do |f|
|
||||
f.find { |l| l =~ /spec_version/ }.match(/[0-9]+/)[0]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user