mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 00:37:57 +00:00
Add srtool GHA (#2755)
This PR introduces the `srtool` GHA which was used in the old `cumulus` repo to build and check runtimes on the weekly basis schedule. The job is triggered: - every Monday at 2AM, automatically - on each tag push or push to the release branch - can be triggered manually as well Addresses #1271
This commit is contained in:
@@ -307,3 +307,40 @@ function increment_rc_tag() {
|
||||
((suffix++))
|
||||
echo $suffix
|
||||
}
|
||||
|
||||
function relative_parent() {
|
||||
echo "$1" | sed -E 's/(.*)\/(.*)\/\.\./\1/g'
|
||||
}
|
||||
|
||||
# Find all the runtimes, it returns the result as JSON object, compatible to be
|
||||
# used as Github Workflow Matrix. This call is exposed by the `scan` command and can be used as:
|
||||
# podman run --rm -it -v /.../fellowship-runtimes:/build docker.io/chevdor/srtool:1.70.0-0.11.1 scan
|
||||
function find_runtimes() {
|
||||
libs=($(git grep -I -r --cached --max-depth 20 --files-with-matches 'construct_runtime!' -- '*lib.rs'))
|
||||
re=".*-runtime$"
|
||||
JSON=$(jq --null-input '{ "include": [] }')
|
||||
|
||||
# EXCLUDED_RUNTIMES is a space separated list of runtime names (without the -runtime postfix)
|
||||
# EXCLUDED_RUNTIMES=${EXCLUDED_RUNTIMES:-"substrate-test"}
|
||||
IFS=' ' read -r -a exclusions <<< "$EXCLUDED_RUNTIMES"
|
||||
|
||||
for lib in "${libs[@]}"; do
|
||||
crate_dir=$(dirname "$lib")
|
||||
cargo_toml="$crate_dir/../Cargo.toml"
|
||||
|
||||
name=$(toml get -r $cargo_toml 'package.name')
|
||||
chain=${name//-runtime/}
|
||||
|
||||
if [[ "$name" =~ $re ]] && ! [[ ${exclusions[@]} =~ $chain ]]; then
|
||||
lib_dir=$(dirname "$lib")
|
||||
runtime_dir=$(relative_parent "$lib_dir/..")
|
||||
ITEM=$(jq --null-input \
|
||||
--arg chain "$chain" \
|
||||
--arg name "$name" \
|
||||
--arg runtime_dir "$runtime_dir" \
|
||||
'{ "chain": $chain, "crate": $name, "runtime_dir": $runtime_dir }')
|
||||
JSON=$(echo $JSON | jq ".include += [$ITEM]")
|
||||
fi
|
||||
done
|
||||
echo $JSON
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user