[ci] add more jobs for pipeline cancel, cleanup (#1314)

This commit is contained in:
Alexander Samusev
2023-08-31 11:36:38 +02:00
committed by GitHub
parent 7cef7cdfb0
commit aabed6757e
56 changed files with 55 additions and 3705 deletions
-4
View File
@@ -1,4 +0,0 @@
changelog.md
*.json
release*.md
.env
-23
View File
@@ -1,23 +0,0 @@
# 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 'changelogerator', '0.10.1'
gem 'test-unit', group: :dev
gem 'rubocop', group: :dev, require: false
-84
View File
@@ -1,84 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
ast (2.4.2)
changelogerator (0.10.1)
git_diff_parser (~> 3)
octokit (~> 4)
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
x86_64-darwin-22
DEPENDENCIES
changelogerator (= 0.10.1)
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
-78
View File
@@ -1,78 +0,0 @@
# 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 parachains-v7.0.0-rc8
```
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
```
By default, the template will include all the information, including the runtime data.
For clients releases, we don't need those and they can be skipped by setting the following env:
```
RELEASE_TYPE=client
```
## 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.
-164
View File
@@ -1,164 +0,0 @@
#!/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')
changelogerator_version = `changelogerator --version`
logger.debug(changelogerator_version)
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-primitives')
polkadot_ref2 = gh_cumulus.get_dependency_reference(ref2, 'polkadot-primitives')
substrate_ref1 = gh_cumulus.get_dependency_reference(ref1, 'sp-io')
substrate_ref2 = gh_cumulus.get_dependency_reference(ref2, 'sp-io')
logger.debug("Cumulus from: #{ref1}")
logger.debug("Cumulus to: #{ref2}")
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
POLKADOT_COLLECTIVES_DIGEST = ENV['COLLECTIVES_POLKADOT_DIGEST'] || 'digests/collectives-polkadot-srtool-digest.json'
SHELL_DIGEST = ENV['SHELL_DIGEST'] || 'digests/shell-srtool-digest.json'
ASSET_HUB_WESTEND_DIGEST = ENV['ASSET_HUB_WESTEND_DIGEST'] || 'digests/asset-hub-westend-srtool-digest.json'
ASSET_HUB_KUSAMA_DIGEST = ENV['ASSET_HUB_KUSAMA_DIGEST'] || 'digests/asset-hub-kusama-srtool-digest.json'
ASSET_HUB_POLKADOT_DIGEST = ENV['ASSET_HUB_POLKADOT_DIGEST'] || 'digests/asset-hub-westend-srtool-digest.json'
BRIDGE_HUB_ROCOCO_DIGEST = ENV['BRIDGE_HUB_ROCOCO_DIGEST'] || 'digests/bridge-hub-rococo-srtool-digest.json'
BRIDGE_HUB_KUSAMA_DIGEST = ENV['BRIDGE_HUB_KUSAMA_DIGEST'] || 'digests/bridge-hub-kusama-srtool-digest.json'
BRIDGE_HUB_POLKADOT_DIGEST = ENV['BRIDGE_HUB_POLKADOT_DIGEST'] || 'digests/bridge-hub-polkadot-srtool-digest.json'
ROCOCO_PARA_DIGEST = ENV['ROCOCO_PARA_DIGEST'] || 'digests/rococo-parachain-srtool-digest.json'
CANVAS_KUSAMA_DIGEST = ENV['CANVAS_KUSAMA_DIGEST'] || 'digests/contracts-rococo-srtool-digest.json'
logger.debug("Release type: #{ENV['RELEASE_TYPE']}")
if ENV['RELEASE_TYPE'] && ENV['RELEASE_TYPE'] == 'client'
logger.debug('Building changelog without runtimes')
cmd = format('jq \
--slurpfile cumulus %s \
--slurpfile substrate %s \
--slurpfile polkadot %s \
-n \'{
cumulus: $cumulus[0],
substrate: $substrate[0],
polkadot: $polkadot[0],
}\' > context.json', cumulus_data, substrate_data, polkadot_data,
)
else
logger.debug('Building changelog with runtimes')
# 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 \
--slurpfile srtool_contracts_rococo %s \
--slurpfile srtool_polkadot_collectives %s \
--slurpfile srtool_bridge_hub_rococo %s \
--slurpfile srtool_bridge_hub_kusama %s \
--slurpfile srtool_bridge_hub_polkadot %s \
-n \'{
cumulus: $cumulus[0],
substrate: $substrate[0],
polkadot: $polkadot[0],
srtool: [
{ order: 10, name: "asset-hub-polkadot", note: " (Former Statemint)", data: $srtool_statemint[0] },
{ order: 11, name: "bridge-hub-polkadot", data: $srtool_bridge_hub_polkadot[0] },
{ order: 20, name: "asset-hub-kusama", note: " (Former Statemine)", data: $srtool_statemine[0] },
{ order: 21, name: "bridge-hub-kusama", data: $srtool_bridge_hub_kusama[0] },
{ order: 30, name: "asset-hub-westend", note: " (Former Westmint)", data: $srtool_westmint[0] },
{ order: 40, name: "rococo", data: $srtool_rococo_parachain[0] },
{ order: 41, name: "bridge-hub-rococo", data: $srtool_bridge_hub_rococo[0] },
{ order: 50, name: "polkadot-collectives", data: $srtool_polkadot_collectives[0] },
{ order: 60, name: "contracts", data: $srtool_contracts_rococo[0] },
{ order: 90, name: "shell", data: $srtool_shell[0] }
] }\' > context.json',
cumulus_data,
substrate_data,
polkadot_data,
SHELL_DIGEST,
ASSET_HUB_WESTEND_DIGEST,
ASSET_HUB_KUSAMA_DIGEST,
ASSET_HUB_POLKADOT_DIGEST,
ROCOCO_PARA_DIGEST,
CANVAS_KUSAMA_DIGEST,
POLKADOT_COLLECTIVES_DIGEST,
BRIDGE_HUB_ROCOCO_DIGEST,
BRIDGE_HUB_KUSAMA_DIGEST,
BRIDGE_HUB_POLKADOT_DIGEST
)
end
system(cmd)
cmd = format('tera --env --env-key env --include-path templates \
--template templates/template.md.tera context.json > %s', output)
system(cmd)
@@ -1 +0,0 @@
*.json
@@ -1,32 +0,0 @@
# 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
@@ -1,44 +0,0 @@
{# This macro shows ONE change #}
{%- macro change(c, cml="[C]", dot="[P]", sub="[S]") -%}
{%- if c.meta.C and c.meta.C.agg.max >= 5 -%}
{%- set prio = " ‼️ HIGH" -%}
{%- elif c.meta.C and c.meta.C.agg.max >= 3 -%}
{%- set prio = " ❗️ Medium" -%}
{%- elif c.meta.C and c.meta.C.agg.max < 3 -%}
{%- set prio = " Low" -%}
{%- else -%}
{%- set prio = "" -%}
{%- endif -%}
{%- set audit = "" -%}
{#
{%- if c.meta.D and c.meta.D.D1 -%}
{%- set audit = "✅ audited " -%}
{%- elif c.meta.D and c.meta.D.D2 -%}
{%- set audit = "✅ trivial " -%}
{%- elif c.meta.D and c.meta.D.D3 -%}
{%- set audit = "✅ trivial " -%}
{%- elif c.meta.D and c.meta.D.D5 -%}
{%- 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.T6 -%}
{%- 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 %}
@@ -1,21 +0,0 @@
{# This include generates the section showing the changes #}
## Changes
### Legend
- {{ CML }} Cumulus
- {{ DOT }} Polkadot
- {{ SUB }} Substrate
{% if env.RELEASE_TYPE and env.RELEASE_TYPE == "client" %}
{% include "changes_client.md.tera" %}
{% else %}
{% include "migrations-runtime.md.tera" -%}
{% include "changes_runtime.md.tera" %}
{% endif %}
{% include "changes_api.md.tera" %}
{% include "changes_misc.md.tera" %}
@@ -1,19 +0,0 @@
{%- import "change.md.tera" as m_c -%}
### API
{#- The changes are sorted by merge date -#}
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B -%}
{%- if pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.B.B1 and pr.meta.T.T2 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor %}
@@ -1,17 +0,0 @@
{% 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.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.B.B1 and pr.meta.T and pr.meta.T.T0 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
@@ -1,39 +0,0 @@
{%- 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.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.agg.max > 2 %}
{%- 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.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.T and pr.meta.T.agg.max > 2 %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{% endif -%}
{% endif -%}
{% endfor %}
{% if misc_count > 10 %}
</details>
{% endif -%}
@@ -1,19 +0,0 @@
{%- 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.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.B.B1 and pr.meta.T.T1 and not pr.title is containing("ompanion") %}
- {{ m_c::change(c=pr) }}
{%- endif -%}
{%- endif -%}
{%- endif -%}
{%- endfor %}
@@ -1,6 +0,0 @@
## 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 }}`
@@ -1,9 +0,0 @@
{%- set to_ignore = changes | filter(attribute="meta.B.B0") %}
<!--
## Debug
changes:
- total: {{ changes | length }}
- silent: {{ to_ignore | length }}
- remaining: {{ changes | length - to_ignore | length }}
-->
@@ -1,11 +0,0 @@
## Docker images
The docker image for this release can be found in [Docker hub](https://hub.docker.com/r/parity/polkadot-parachain/tags?page=1&ordering=last_updated).
(It will be available a few minutes after the release has been published).
You may also pull it with:
```
docker pull parity/polkadot-parachain:latest
```
@@ -1,35 +0,0 @@
{%- 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 %}
<!--
- Cumulus: {{ cumulus_prio }}
- Polkadot: {{ polkadot_prio }}
- Substrate: {{ substrate_prio }}
-->
{# We show the result #}
{{ m_p::high_priority(p=global_prio, changes=changes) }}
@@ -1,56 +0,0 @@
{%- import "change.md.tera" as m_c -%}
{# This macro convert a priority level into readable output #}
{%- macro high_priority(p, changes) -%}
{# real globals don't work so we count the number of host functions here as well #}
{# unfortunately, the next snippet is duplicated in the host_functions.md.tera template #}
{# as well #}
{%- set_global host_fn_count = 0 -%}
{# We loop first to count the number of host functions but we do not display anything yet #}
{%- for pr in changes -%}
{%- if pr.meta.B and pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.E4 -%}
{%- set_global host_fn_count = host_fn_count + 1 -%}
{%- endif -%}
{%- endif -%}
{%- endfor -%}
{%- if p >= 5 or host_fn_count > 0 -%}
{%- set prio = "‼️ HIGH" -%}
{%- set text = "This is a **high priority** release and you must upgrade as as soon as possible." -%}
{%- elif p >= 3 -%}
{%- set prio = "❗️ Medium" -%}
{%- set text = "This is a medium priority release and you should upgrade in a timely manner." -%}
{%- else -%}
{%- set prio = "Low" -%}
{%- set text = "This is a low priority release and you may upgrade at your convenience." -%}
{%- endif -%}
<!-- detected max prio is: {{p}} -->
{% if prio -%}
{{prio}}: {{text}}
{%- else -%}
<!-- No relevant Priority label as been detected -->
{%- endif %}
{# We only show details if Medium or High #}
{%- if p >= 5 -%}
The changes motivating this priority level are:
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.C -%}
{%- if pr.meta.C.agg.max >= p %}
- {{ m_c::change(c=pr) }}
{%- if pr.meta.B and pr.meta.B.B1 and pr.meta.T and pr.meta.T.T1 %}
(RUNTIME)
{% endif %}
{%- endif -%}
{%- endif -%}
{%- endfor %}
{%- endif %}
{%- endmacro priority -%}
@@ -1,38 +0,0 @@
{%- import "change.md.tera" as m_c -%}
{%- set_global host_fn_count = 0 -%}
{# We loop first to count the number of host functions but we do not display anything yet #}
{%- for pr in changes -%}
{%- if pr.meta.B and pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.E4 -%}
{%- set_global host_fn_count = host_fn_count + 1 -%}
{% endif -%}
{%- endif -%}
{%- endfor -%}
<!-- {{ host_fn_count }} host functions were detected -->
{% if host_fn_count == 0 -%}
<!-- ️ This release does not contain any new host functions. -->
{%- else -%}
## Host functions
⚠️ 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.
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.B0 -%}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.E4 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{%- endfor -%}
{%- endif %}
@@ -1,26 +0,0 @@
{%- import "change.md.tera" as m_c %}
{%- set_global db_migration_count = 0 -%}
## Database Migrations
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.E2 -%}
{%- set_global db_migration_count = db_migration_count + 1 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{% endfor -%}
{%- if db_migration_count == 0 -%}
No Database migration detected in this release.
{% else %}
There is {{ db_migration_count }} database migration(s) in this release.
Database migrations are operations bringing your database to the latest stand.
Some migrations may break compatibility and making a backup of your database is highly recommended.
{%- endif %}
@@ -1,14 +0,0 @@
{%- import "change.md.tera" as m_c %}
## Runtime Migrations
{% for pr in changes | sort(attribute="merged_at") -%}
{%- if pr.meta.B and pr.meta.B.B0 %}
{#- We skip silent ones -#}
{%- else -%}
{%- if pr.meta.E and pr.meta.E.E1 -%}
- {{ m_c::change(c=pr) }}
{% endif -%}
{% endif -%}
{% endfor -%}
@@ -1,11 +0,0 @@
{%- 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 %}
@@ -1,28 +0,0 @@
{# This macro shows one runtime #}
{%- macro runtime(runtime) -%}
### {{ runtime.name | replace(from="-", to=" ") | title }} {%- if runtime.note -%} {{ runtime.note }} {%- endif -%}
{%- 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 }} -->
<!-- system.setCode : {{ runtime.data.runtimes.compressed.subwasm.proposal_hash }} -->
<!-- authorizeUpgrade : {{ runtime.data.runtimes.compressed.subwasm.parachain_authorize_upgrade_hash }} -->
```
🏋️ 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.specName }}-{{ runtime.data.runtimes.compressed.subwasm.core_version.specVersion }} ({{ runtime.data.runtimes.compressed.subwasm.core_version.implName }}-{{ runtime.data.runtimes.compressed.subwasm.core_version.implVersion }}.tx{{ runtime.data.runtimes.compressed.subwasm.core_version.transactionVersion }}.au{{ runtime.data.runtimes.compressed.subwasm.core_version.authoringVersion }})
🗜 Compressed: {{ compressed }}: {{ comp_ratio | round(method="ceil", precision=2) }}%
🎁 Metadata version: V{{ runtime.data.runtimes.compressed.subwasm.metadata_version }}
🗳️ Blake2-256 hash: {{ runtime.data.runtimes.compressed.subwasm.blake2_256 }}
📦 IPFS: {{ runtime.data.runtimes.compressed.subwasm.ipfs_hash }}
```
{%- endmacro runtime %}
@@ -1,17 +0,0 @@
{# 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="order") %}
{%- set HIDE_VAR = "HIDE_SRTOOL_" ~ runtime.name | upper %}
{%- if not env is containing(HIDE_VAR) %}
{{ m_r::runtime(runtime=runtime) }}
{%- endif %}
{%- endfor %}
@@ -1,38 +0,0 @@
{# This is the entry point of the template for the parachains-* releases-#}
<!-- 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]" -%}
{# We check for host function first because no matter what the priority is, #}
{# we will force it to HIGH if at least one host function was detected. #}
{% include "host_functions.md.tera" -%}
{% if env.RELEASE_TYPE and env.RELEASE_TYPE == "client" -%}
{% include "global_priority.md.tera" -%}
{% include "compiler.md.tera" -%}
{% include "migrations-db.md.tera" %}
<!-- skipping runtime data for RELEASE_TYPE = {{ env.RELEASE_TYPE }} -->
{% else %}
{% include "migrations-runtime.md.tera" %}
{% include "runtimes.md.tera" -%}
{% endif %}
{% include "changes.md.tera" -%}
{% if env.RELEASE_TYPE and env.RELEASE_TYPE == "client" -%}
{% include "docker_image.md.tera" -%}
{% endif %}
@@ -1,23 +0,0 @@
# 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
-141
View File
@@ -1,141 +0,0 @@
#!/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
}
-53
View File
@@ -1,53 +0,0 @@
#!/usr/bin/env bash
set -Eeu -o pipefail
shopt -s inherit_errexit
PR_TITLE="$1"
HEAD_REF="$2"
ORG="paritytech"
REPO="$CI_PROJECT_NAME"
BASE_REF="$CI_COMMIT_BRANCH"
# Change threshold in %. Bigger values excludes the small changes.
THRESHOLD=${THRESHOLD:-30}
WEIGHTS_COMPARISON_URL_PARTS=(
"https://weights.tasty.limo/compare?"
"repo=$REPO&"
"threshold=$THRESHOLD&"
"path_pattern=**%2Fweights%2F*.rs&"
"method=guess-worst&"
"ignore_errors=true&"
"unit=time&"
"old=$BASE_REF&"
"new=$HEAD_REF"
)
printf -v WEIGHTS_COMPARISON_URL %s "${WEIGHTS_COMPARISON_URL_PARTS[@]}"
PAYLOAD="$(jq -n \
--arg title "$PR_TITLE" \
--arg body "
This PR is generated automatically by CI.
Compare the weights with \`$BASE_REF\`: $WEIGHTS_COMPARISON_URL
- [ ] Backport to master and node release branch once merged
" \
--arg base "$BASE_REF" \
--arg head "$HEAD_REF" \
'{
title: $title,
body: $body,
head: $head,
base: $base
}'
)"
echo "PAYLOAD: $PAYLOAD"
curl \
-H "Authorization: token $GITHUB_TOKEN" \
-X POST \
-d "$PAYLOAD" \
"https://api.github.com/repos/$ORG/$REPO/pulls"
-127
View File
@@ -1,127 +0,0 @@
#!/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 | sed 's/.*github.com\/\(.*\)/\1/g' | cut -d '/' -f2 | cut -d '.' -f1 | sort | uniq)
echo "[+] Detected repo: $REPO"
BRANCH=$(git branch --show-current)
if ! [[ "$BRANCH" =~ ^release.*$ || "$BRANCH" =~ ^polkadot.*$ ]]; 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
-91
View File
@@ -1,91 +0,0 @@
#!/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-note_worthy'
)
# Must be an ordered list of priorities, lowest first
priority_labels=(
'C1-low'
'C3-medium'
'C5-high'
'C7-critical'
)
audit_labels=(
'D1-audited 👍'
'D2-notlive 💤'
'D3-trivial 🧸'
'D5-nicetohaveaudit ⚠️'
'D9-needsaudit 👮'
)
x_labels=(
'X0-node'
'X1-runtime'
'X2-API'
'X9-misc'
)
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
if has_label "$repo" "$pr" 'B1-note_worthy'; then
echo "[+] B1-note_worthy is chosen. Checking that there X-labels for $CI_COMMIT_BRANCH"
if ensure_labels "${x_labels[@]}"; then
echo "[+] X-label detected. All is well."
else
echo "[!] X-label not detected. Please add one of: ${x_labels[*]}"
exit 1
fi
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
@@ -1,55 +0,0 @@
#!/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"
@@ -1,10 +0,0 @@
# 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
@@ -1,84 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "benchmarks" stage
# Work only on release-parachains-v* branches
benchmarks-build:
stage: benchmarks-build
extends:
- .docker-env
- .collect-artifacts
- .benchmarks-manual-refs
script:
- time cargo build --profile production --locked --features runtime-benchmarks
- mkdir -p artifacts
- cp target/production/polkadot-parachain ./artifacts/
benchmarks-assets:
stage: benchmarks-run
timeout: 1d
extends:
- .docker-env
- .collect-artifacts
- .benchmarks-refs
before_script:
- !reference [.docker-env, before_script]
script:
- ./scripts/benchmarks-ci.sh assets asset-hub-kusama ./artifacts
- ./scripts/benchmarks-ci.sh assets asset-hub-polkadot ./artifacts
- ./scripts/benchmarks-ci.sh assets asset-hub-westend ./artifacts
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-asset-hub-polkadot-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
- ./scripts/ci/create-benchmark-pr.sh "[benchmarks] Update weights for asset-hub-kusama/-polkadot" "$BRANCHNAME"
- rm -f ./artifacts/polkadot-parachain
- rm -f ./artifacts/test-parachain
after_script:
- rm -rf .git/config
tags:
- weights-vm
benchmarks-collectives:
stage: benchmarks-run
timeout: 1d
extends:
- .docker-env
- .collect-artifacts
- .benchmarks-refs
before_script:
- !reference [.docker-env, before_script]
script:
- ./scripts/benchmarks-ci.sh collectives collectives-polkadot ./artifacts
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-collectives-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
- ./scripts/ci/create-benchmark-pr.sh "[benchmarks] Update weights for collectives" "$BRANCHNAME"
- rm -f ./artifacts/polkadot-parachain
- rm -f ./artifacts/test-parachain
after_script:
- rm -rf .git/config
tags:
- weights-vm
benchmarks-bridge-hubs:
stage: benchmarks-run
timeout: 1d
extends:
- .docker-env
- .collect-artifacts
- .benchmarks-refs
before_script:
- !reference [.docker-env, before_script]
script:
- ./scripts/benchmarks-ci.sh bridge-hubs bridge-hub-polkadot ./artifacts
- ./scripts/benchmarks-ci.sh bridge-hubs bridge-hub-kusama ./artifacts
- ./scripts/benchmarks-ci.sh bridge-hubs bridge-hub-rococo ./artifacts
- export CURRENT_TIME=$(date '+%s')
- export BRANCHNAME="weights-bridge-hubs-${CI_COMMIT_BRANCH}-${CURRENT_TIME}"
- !reference [.git-commit-push, script]
- ./scripts/ci/create-benchmark-pr.sh "[benchmarks] Update weights for bridge-hubs" "$BRANCHNAME"
- rm -f ./artifacts/polkadot-parachain
- rm -f ./artifacts/test-parachain
after_script:
- rm -rf .git/config
tags:
- weights-vm
@@ -1,138 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "build" stage
build-linux-stable:
stage: build
extends:
- .docker-env
- .common-refs
- .collect-artifacts
variables:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
script:
- echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
- time cargo build --release --locked --bin polkadot-parachain
- echo "___Packing the artifacts___"
- mkdir -p ./artifacts
- mv ./target/release/polkadot-parachain ./artifacts/.
- echo "___The VERSION is either a tag name or the curent branch if triggered not by a tag___"
- echo ${CI_COMMIT_REF_NAME} | tee ./artifacts/VERSION
build-test-parachain:
stage: build
extends:
- .docker-env
- .common-refs
- .collect-artifacts
variables:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
script:
- echo "___Building a binary, please refrain from using it in production since it goes with the debug assertions.___"
- time cargo build --release --locked --bin test-parachain
- echo "___Packing the artifacts___"
- mkdir -p ./artifacts
- mv ./target/release/test-parachain ./artifacts/.
- mkdir -p ./artifacts/zombienet
- mv ./target/release/wbuild/cumulus-test-runtime/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm ./artifacts/zombienet/.
# build runtime only if files in $RUNTIME_PATH/$RUNTIME_NAME were changed
.build-runtime-template: &build-runtime-template
stage: build
extends:
- .docker-env
- .pr-refs
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
variables:
RUNTIME_PATH: "parachains/runtimes/assets"
script:
- cd ${RUNTIME_PATH}
- for directory in $(echo */); do
echo "_____Running cargo check for ${directory} ______";
cd ${directory};
pwd;
SKIP_WASM_BUILD=1 cargo check --locked;
cd ..;
done
# DAG: build-runtime-assets -> build-runtime-collectives -> build-runtime-bridge-hubs
# DAG: build-runtime-assets -> build-runtime-collectives -> build-runtime-contracts
# DAG: build-runtime-assets -> build-runtime-starters -> build-runtime-testing
build-runtime-assets:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/assets"
build-runtime-collectives:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/collectives"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-assets
artifacts: false
build-runtime-bridge-hubs:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/bridge-hubs"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-collectives
artifacts: false
build-runtime-contracts:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/contracts"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-collectives
artifacts: false
build-runtime-starters:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/starters"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-assets
artifacts: false
build-runtime-testing:
<<: *build-runtime-template
variables:
RUNTIME_PATH: "parachains/runtimes/testing"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: build-runtime-starters
artifacts: false
build-short-benchmark:
stage: build
extends:
- .docker-env
- .common-refs
- .collect-artifacts
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
script:
- cargo build --profile release --locked --features=runtime-benchmarks --bin polkadot-parachain
- mkdir -p ./artifacts
- cp ./target/release/polkadot-parachain ./artifacts/
@@ -1,2 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "integration_stage" stage
@@ -1,105 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "publish" stage
.build-push-image:
image: $BUILDAH_IMAGE
variables:
DOCKERFILE: "" # docker/path-to.Dockerfile
IMAGE_NAME: "" # docker.io/paritypr/image_name
VERSION: "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
script:
- test "$PARITYPR_USER" -a "$PARITYPR_PASS" ||
( echo "no docker credentials provided"; exit 1 )
- $BUILDAH_COMMAND build
--format=docker
--build-arg VCS_REF="${CI_COMMIT_SHA}"
--build-arg BUILD_DATE="$(date -u '+%Y-%m-%dT%H:%M:%SZ')"
--build-arg IMAGE_NAME="${IMAGE_NAME}"
--tag "$IMAGE_NAME:$VERSION"
--file ${DOCKERFILE} .
- echo "$PARITYPR_PASS" |
buildah login --username "$PARITYPR_USER" --password-stdin docker.io
- $BUILDAH_COMMAND info
- $BUILDAH_COMMAND push --format=v2s2 "$IMAGE_NAME:$VERSION"
after_script:
- buildah logout --all
build-push-image-polkadot-parachain-debug:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .build-push-image
needs:
- job: build-linux-stable
artifacts: true
variables:
DOCKERFILE: "docker/polkadot-parachain-debug_unsigned_injected.Dockerfile"
IMAGE_NAME: "docker.io/paritypr/polkadot-parachain-debug"
VERSION: "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
build-push-image-test-parachain:
stage: publish
extends:
- .kubernetes-env
- .common-refs
- .build-push-image
needs:
- job: build-test-parachain
artifacts: true
variables:
DOCKERFILE: "docker/test-parachain_injected.Dockerfile"
IMAGE_NAME: "docker.io/paritypr/test-parachain"
VERSION: "${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
publish-s3:
stage: publish
extends:
- .kubernetes-env
- .publish-refs
image: paritytech/awscli:latest
needs:
- job: build-linux-stable
artifacts: true
variables:
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "cumulus/${ARCH}-${DOCKER_OS}"
script:
- echo "___Publishing a binary with debug assertions!___"
- echo "___VERSION = $(cat ./artifacts/VERSION) ___"
- aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/
- echo "___Updating objects in latest path___"
- aws s3 sync s3://${BUCKET}/${PREFIX}/$(cat ./artifacts/VERSION)/ s3://${BUCKET}/${PREFIX}/latest/
after_script:
- aws s3 ls s3://${BUCKET}/${PREFIX}/latest/
--recursive --human-readable --summarize
publish-benchmarks-assets-s3: &publish-benchmarks
stage: publish
extends:
- .kubernetes-env
- .benchmarks-refs
image: paritytech/awscli:latest
needs:
- job: benchmarks-assets
artifacts: true
variables:
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "cumulus/$CI_COMMIT_REF_NAME/benchmarks-assets"
script:
- echo "___Publishing benchmark results___"
- aws s3 sync ./artifacts/ s3://${BUCKET}/${PREFIX}/
after_script:
- aws s3 ls s3://${BUCKET}/${PREFIX}/ --recursive --human-readable --summarize
publish-benchmarks-collectives-s3:
<<: *publish-benchmarks
variables:
GIT_STRATEGY: none
BUCKET: "releases.parity.io"
PREFIX: "cumulus/$CI_COMMIT_REF_NAME/benchmarks-collectives"
needs:
- job: benchmarks-collectives
artifacts: true
@@ -1,56 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "short-benchmarks" stage
# Run all pallet benchmarks only once to check if there are any errors
.short-benchmark-template: &short-bench
stage: short-benchmarks
extends:
- .common-refs
- .docker-env
needs:
- job: build-short-benchmark
artifacts: true
variables:
RUNTIME_CHAIN: benchmarked-runtime-chain
script:
- ./artifacts/polkadot-parachain benchmark pallet --wasm-execution compiled --chain $RUNTIME_CHAIN --pallet "*" --extrinsic "*" --steps 2 --repeat 1
short-benchmark-asset-hub-polkadot:
<<: *short-bench
variables:
RUNTIME_CHAIN: asset-hub-polkadot-dev
short-benchmark-asset-hub-kusama:
<<: *short-bench
variables:
RUNTIME_CHAIN: asset-hub-kusama-dev
short-benchmark-asset-hub-westend:
<<: *short-bench
variables:
RUNTIME_CHAIN: asset-hub-westend-dev
short-benchmark-bridge-hub-polkadot:
<<: *short-bench
variables:
RUNTIME_CHAIN: bridge-hub-polkadot-dev
short-benchmark-bridge-hub-kusama:
<<: *short-bench
variables:
RUNTIME_CHAIN: bridge-hub-kusama-dev
short-benchmark-bridge-hub-rococo:
<<: *short-bench
variables:
RUNTIME_CHAIN: bridge-hub-rococo-dev
short-benchmark-collectives-polkadot :
<<: *short-bench
variables:
RUNTIME_CHAIN: collectives-polkadot-dev
short-benchmark-glutton-kusama :
<<: *short-bench
variables:
RUNTIME_CHAIN: glutton-kusama-dev-1300
-111
View File
@@ -1,111 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "test" stage
# It's more like a check, but we want to run this job with real tests in parallel
find-fail-ci-phrase:
stage: test
variables:
CI_IMAGE: "paritytech/tools:latest"
ASSERT_REGEX: "FAIL-CI"
GIT_DEPTH: 1
extends:
- .kubernetes-env
script:
- set +e
- rg --line-number --hidden --type rust --glob '!{.git,target}' "$ASSERT_REGEX" .; exit_status=$?
- if [ $exit_status -eq 0 ]; then
echo "$ASSERT_REGEX was found, exiting with 1";
exit 1;
else
echo "No $ASSERT_REGEX was found, exiting with 0";
exit 0;
fi
test-linux-stable:
stage: test
extends:
- .docker-env
- .common-refs
- .pipeline-stopper-artifacts
before_script:
- !reference [.docker-env, before_script]
- !reference [.pipeline-stopper-vars, before_script]
variables:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo nextest run --all --release --locked --run-ignored all
test-doc:
stage: test
extends:
- .docker-env
- .common-refs
variables:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
script:
- time cargo test --doc
check-runtime-benchmarks:
stage: test
extends:
- .docker-env
- .common-refs
script:
# Check that the node will compile with `runtime-benchmarks` feature flag.
- time cargo check --locked --all --features runtime-benchmarks
# Check that parachain-template will compile with `runtime-benchmarks` feature flag.
- time cargo check --locked -p parachain-template-node --features runtime-benchmarks
cargo-check-try-runtime:
stage: test
extends:
- .docker-env
- .common-refs
variables:
RUSTFLAGS: "-D warnings"
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-runtime-benchmarks
artifacts: false
script:
# Check that the node will compile with `try-runtime` feature flag.
- time cargo check --locked --all --features try-runtime
# Check that parachain-template will compile with `try-runtime` feature flag.
- time cargo check --locked -p parachain-template-node --features try-runtime
check-rustdoc:
stage: test
extends:
- .docker-env
- .common-refs
variables:
SKIP_WASM_BUILD: 1
RUSTDOCFLAGS: "-Dwarnings"
script:
- time cargo doc --workspace --all-features --verbose --no-deps
cargo-check-benches:
stage: test
extends:
- .docker-env
- .common-refs
# this is an artificial job dependency, for pipeline optimization using GitLab's DAGs
needs:
- job: check-rustdoc
artifacts: false
script:
- time cargo check --all --benches
cargo-clippy:
stage: test
extends:
- .docker-env
- .common-refs
script:
- echo $RUSTFLAGS
- cargo version && cargo clippy --version
- SKIP_WASM_BUILD=1 env -u RUSTFLAGS cargo clippy --locked --all-targets --workspace
@@ -1,141 +0,0 @@
# This file is part of .gitlab-ci.yml
# Here are all jobs that are executed during "zombienet" stage
.zombienet-before-script:
before_script:
- echo "Zombie-net Tests Config"
- echo "${ZOMBIENET_IMAGE}"
- echo "${RELAY_IMAGE}"
- echo "${COL_IMAGE}"
- echo "${GH_DIR}"
- export DEBUG=zombie
- export RELAY_IMAGE=${POLKADOT_IMAGE}
- export COL_IMAGE=${COL_IMAGE}
.zombienet-after-script:
after_script:
- mkdir -p ./zombienet-logs
- cp /tmp/zombie*/logs/* ./zombienet-logs/
# common settings for all zombienet jobs
.zombienet-common:
stage: zombienet
image: "${ZOMBIENET_IMAGE}"
needs:
- job: build-push-image-test-parachain
artifacts: true
variables:
POLKADOT_IMAGE: "docker.io/paritypr/polkadot-debug:master"
GH_DIR: "https://github.com/paritytech/cumulus/tree/${CI_COMMIT_SHORT_SHA}/zombienet/tests"
COL_IMAGE: "docker.io/paritypr/test-parachain:${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}"
FF_DISABLE_UMASK_FOR_DOCKER_EXECUTOR: 1
artifacts:
name: "${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}"
when: always
expire_in: 2 days
paths:
- ./zombienet-logs
allow_failure: false
retry: 2
tags:
- zombienet-polkadot-integration-test
zombienet-0001-sync_blocks_from_tip_without_connected_collator:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0001-sync_blocks_from_tip_without_connected_collator.zndsl"
zombienet-0002-pov_recovery:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0002-pov_recovery.zndsl"
zombienet-0003-full_node_catching_up:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0003-full_node_catching_up.zndsl"
zombienet-0004-runtime_upgrade:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
needs:
- !reference [.zombienet-common, needs]
- job: build-test-parachain
artifacts: true
before_script:
- ls -ltr *
- cp ./artifacts/zombienet/wasm_binary_spec_version_incremented.rs.compact.compressed.wasm /tmp/
- ls /tmp
- !reference [.zombienet-before-script, before_script]
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0004-runtime_upgrade.zndsl"
zombienet-0005-migrate_solo_to_para:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
needs:
- !reference [.zombienet-common, needs]
- job: build-test-parachain
artifacts: true
before_script:
- ls -ltr *
- !reference [.zombienet-before-script, before_script]
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0005-migrate_solo_to_para.zndsl"
zombienet-0006-rpc_collator_builds_blocks:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0006-rpc_collator_builds_blocks.zndsl"
zombienet-0007-full_node_warp_sync:
extends:
- .zombienet-common
- .zombienet-refs
- .zombienet-before-script
- .zombienet-after-script
script:
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
--github-remote-dir="${GH_DIR}"
--concurrency=1
--test="0007-full_node_warp_sync.zndsl"
-6
View File
@@ -1,6 +0,0 @@
#!/bin/sh
# meant to be installed via
# git config filter.ci-prettier.clean "scripts/ci/gitlab/prettier.sh"
prettier --parser yaml