Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/electra' into electra
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden committed Feb 19, 2025
2 parents cf4944e + 48b3811 commit 5763c12
Show file tree
Hide file tree
Showing 642 changed files with 42,177 additions and 11,539 deletions.
5 changes: 5 additions & 0 deletions .config/lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,15 @@ exclude = [
# Behind a captcha (code 403):
"https://chainlist.org/chain/*",
"https://iohk.io/en/blog/posts/2023/11/03/partner-chains-are-coming-to-cardano/",
"https://polymesh.network",
"https://www.reddit.com/r/rust/comments/3spfh1/does_collect_allocate_more_than_once_while/",

# 403 rate limited:
"https://etherscan.io/block/11090290",
"https://subscan.io/",
"https://substrate.stackexchange.com/.*",

# Exclude strings which contain templates like {} and {:?}
"%7B%7D",
"%7B:\\?}",
]
23 changes: 10 additions & 13 deletions .github/scripts/generate-prdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ def from_pr_number(n, audience, bump, force):
def translate_audience(audience):
aliases = {
'runtime_dev': 'Runtime Dev',
'runtime_user': 'Runtime Operator',
'runtime_user': 'Runtime User',
'node_dev': 'Node Dev',
'node_user': 'Node User',
'node_operator': 'Node Operator',
'todo': 'Todo',
}

if audience in aliases:
to = aliases[audience]
print(f"Translated audience '{audience}' to '{to}'")
audience = to
mapped = [aliases.get(a) for a in audience]
if len(mapped) == 1:
mapped = mapped[0]

return audience
print(f"Translated audience '{audience}' to '{mapped}'")
return mapped

def create_prdoc(pr, audience, title, description, patch, bump, force):
path = f"prdoc/pr_{pr}.prdoc"
Expand Down Expand Up @@ -128,7 +129,7 @@ def yaml_multiline_string_presenter(dumper, data):
# parse_args is also used by cmd/cmd.py
# if pr_required is False, then --pr is optional, as it can be derived from the PR comment body
def setup_parser(parser=None, pr_required=True):
allowed_audiences = ["runtime_dev", "runtime_user", "node_dev", "node_operator"]
allowed_audiences = ["runtime_dev", "runtime_user", "node_dev", "node_operator", "todo"]
if parser is None:
parser = argparse.ArgumentParser()
parser.add_argument("--pr", type=int, required=pr_required, help="The PR number to generate the PrDoc for.")
Expand All @@ -144,11 +145,7 @@ def main(args):
print(f"Args: {args}, force: {args.force}")
setup_yaml()
try:
# Convert snake_case audience arguments to title case
mapped_audiences = [snake_to_title(a) for a in args.audience]
if len(mapped_audiences) == 1:
mapped_audiences = mapped_audiences[0]
from_pr_number(args.pr, mapped_audiences, args.bump, args.force)
from_pr_number(args.pr, args.audience, args.bump, args.force)
return 0
except Exception as e:
print(f"Error generating prdoc: {e}")
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/benchmarks-subsystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ permissions:
contents: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

build:
timeout-minutes: 80
needs: [preflight]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ permissions:
contents: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

build-runtimes-polkavm:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/build-publish-eth-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -15,10 +15,13 @@ env:
ETH_RPC_IMAGE_NAME: "docker.io/paritypr/eth-rpc"

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
set-variables:
# This workaround sets the container image for each job using 'set-variables' job output.
# env variables don't work for PR from forks, so we need to use outputs.
runs-on: ubuntu-latest
needs: isdraft
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
Expand Down Expand Up @@ -77,4 +80,3 @@ jobs:
push: true
tags: |
${{ env.ETH_RPC_IMAGE_NAME }}:${{ env.VERSION }}
9 changes: 4 additions & 5 deletions .github/workflows/build-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -18,7 +18,10 @@ jobs:
#
#
#
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

### Build ########################
Expand Down Expand Up @@ -234,10 +237,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# tldr: we need to checkout the branch HEAD explicitly because of our dynamic versioning approach while building the substrate binary
# see https://github.com/paritytech/ci_cd/issues/682#issuecomment-1340953589
ref: ${{ github.head_ref || github.ref_name }}
- name: build
run: |
mkdir -p ./artifacts/substrate/
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-cargo-check-runtimes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ on:
# Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

check-runtime-assets:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check-frame-omni-bencher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled]
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

concurrency:
Expand All @@ -16,7 +16,10 @@ env:
ARTIFACTS_NAME: frame-omni-bencher-artifacts

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

quick-benchmarks-omni:
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/check-getting-started.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ on:
paths:
- ".github/workflows/check-getting-started.yml"
- "scripts/getting-started.sh"
types: [opened, synchronize, reopened, ready_for_review]
schedule:
- cron: "0 5 * * *"
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
check-getting-started:
needs: isdraft
strategy:
fail-fast: true
matrix:
Expand Down Expand Up @@ -179,6 +182,7 @@ jobs:
timeout-minutes: 5

check-getting-started-macos:
needs: isdraft
strategy:
fail-fast: true
matrix:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Check licenses

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:

concurrency:
Expand All @@ -12,8 +13,11 @@ permissions:
packages: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
check-licenses:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
env:
LICENSES: "'Apache-2.0' 'GPL-3.0-only' 'GPL-3.0-or-later WITH Classpath-exception-2.0' 'MIT-0' 'Unlicense'"
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ permissions:
packages: read

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
link-checker:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
steps:
- name: Restore lychee cache
Expand All @@ -33,7 +36,7 @@ jobs:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.0 (22. Sep 2023)

- name: Lychee link checker
uses: lycheeverse/lychee-action@f81112d0d2814ded911bd23e3beaa9dda9093915 # for v1.9.1 (10. Jan 2024)
uses: lycheeverse/lychee-action@f613c4a64e50d792e0b31ec34bbcbba12263c6a6 # for v1.9.1 (10. Jan 2024)
with:
args: >-
--config .config/lychee.toml
Expand Down
42 changes: 13 additions & 29 deletions .github/workflows/check-prdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,49 +22,33 @@ jobs:
check-prdoc:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.event.pull_request.number != ''
steps:
- name: Checkout repo
uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc #v4.1.7
# we cannot show the version in this step (ie before checking out the repo)
# due to https://github.com/paritytech/prdoc/issues/15
- name: Check if PRdoc is required
id: get-labels
- name: Check prdoc format
run: |
echo "Pulling $IMAGE"
$ENGINE pull $IMAGE
# Fetch the labels for the PR under test
echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
echo "Labels: ${labels}"
echo "labels=${labels}" >> "$GITHUB_OUTPUT"
echo "Checking PRdoc version"
$ENGINE run --rm -v $PWD:/repo $IMAGE --version
- name: Early exit if PR is silent
if: ${{ contains(steps.get-labels.outputs.labels, 'R0') }}
run: |
hits=$(find prdoc -name "pr_$GITHUB_PR*.prdoc" | wc -l)
if (( hits > 0 )); then
echo "PR detected as silent, but a PRDoc was found, checking it as information"
$ENGINE run --rm -v $PWD:/repo $IMAGE check -n ${GITHUB_PR} || echo "Ignoring failure"
else
echo "PR detected as silent, no PRDoc found, exiting..."
fi
echo "If you want to add a PRDoc, please refer to $PRDOC_DOC"
exit 0
echo "Check prdoc format"
echo "For PRDoc format, please refer to $PRDOC_DOC"
$ENGINE run --rm -v $PWD:/repo -e RUST_LOG=info $IMAGE check
- name: PRdoc check for PR#${{ github.event.pull_request.number }}
if: ${{ !contains(steps.get-labels.outputs.labels, 'R0') }}
- name: Check if PRdoc is required
if: github.event.pull_request.number != ''
id: get-labels
run: |
echo "Checking for PR#${GITHUB_PR}"
echo "You can find more information about PRDoc at $PRDOC_DOC"
$ENGINE run --rm -v $PWD:/repo -e RUST_LOG=info $IMAGE check -n ${GITHUB_PR}
# Fetch the labels for the PR under test
echo "Fetch the labels for $API_BASE/${REPO}/pulls/${GITHUB_PR}"
labels=$( curl -H "Authorization: token ${GITHUB_TOKEN}" -s "$API_BASE/${REPO}/pulls/${GITHUB_PR}" | jq '.labels | .[] | .name' | tr "\n" ",")
echo "Labels: ${labels}"
echo "labels=${labels}" >> "$GITHUB_OUTPUT"
- name: Validate prdoc for PR#${{ github.event.pull_request.number }}
if: ${{ !contains(steps.get-labels.outputs.labels, 'R0') }}
if: ${{ github.event.pull_request.number != '' && !contains(steps.get-labels.outputs.labels, 'R0') }}
run: |
echo "Validating PR#${GITHUB_PR}"
python3 --version
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ concurrency:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

# More info can be found here: https://github.com/paritytech/polkadot/pull/5865
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ env:
TOOLCHAIN: nightly-2024-11-19

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml
check-semver:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -68,7 +71,7 @@ jobs:

- name: Rust Cache
if: ${{ !contains(github.event.pull_request.labels.*.name, 'R0-silent') }}
uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5
uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
cache-on-failure: true

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/checks-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ concurrency:
permissions: {}

jobs:
isdraft:
uses: ./.github/workflows/reusable-isdraft.yml
preflight:
needs: isdraft
uses: ./.github/workflows/reusable-preflight.yml

fmt:
Expand All @@ -37,6 +40,7 @@ jobs:
app-key: ${{ secrets.WORKFLOW_STOPPER_RUNNER_APP_KEY }}
check-dependency-rules:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7
Expand Down Expand Up @@ -84,6 +88,7 @@ jobs:
echo "Please run `taplo format --config .config/taplo.toml` to fix any toml formatting issues"
check-workspace:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.0 (22. Sep 2023)
Expand All @@ -102,6 +107,7 @@ jobs:
run: python3 .github/scripts/deny-git-deps.py .
check-markdown:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 20
steps:
- name: Checkout sources
Expand Down Expand Up @@ -154,6 +160,7 @@ jobs:
fi
check-fail-ci:
runs-on: ubuntu-latest
needs: isdraft
container:
# there's no "rg" in ci-unified, and tools is a smaller image anyway
image: "paritytech/tools:latest"
Expand All @@ -179,6 +186,7 @@ jobs:
GIT_DEPTH: 1
check-readme:
runs-on: ubuntu-latest
needs: isdraft
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
Expand Down
Loading

0 comments on commit 5763c12

Please sign in to comment.