Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into polkadot-parachai…
Browse files Browse the repository at this point in the history
…n-u64
  • Loading branch information
serban300 committed Aug 28, 2024
2 parents f46339e + 09254eb commit b7ce602
Show file tree
Hide file tree
Showing 281 changed files with 30,524 additions and 1,932 deletions.
2 changes: 1 addition & 1 deletion .config/lychee.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ exclude = [
"https://github.com/paritytech/polkadot-sdk/substrate/frame/timestamp",
"https://github.com/paritytech/substrate/frame/fast-unstake",
"https://github.com/zkcrypto/bls12_381/blob/e224ad4ea1babfc582ccd751c2bf128611d10936/src/test-data/mod.rs",
"https://polkadot-try-runtime-node.parity-chains.parity.io/",
"https://polkadot.network/the-path-of-a-parachain-block/",
"https://research.web3.foundation/en/latest/polkadot/NPoS/3.%20Balancing.html",
"https://research.web3.foundation/en/latest/polkadot/Token%20Economics.html#inflation-model",
Expand All @@ -41,6 +40,7 @@ exclude = [
"https://research.web3.foundation/en/latest/polkadot/overview/2-token-economics.html#inflation-model",
"https://research.web3.foundation/en/latest/polkadot/slashing/npos.html",
"https://rpc.polkadot.io/",
"https://try-runtime.polkadot.io/",
"https://w3f.github.io/parachain-implementers-guide/node/approval/approval-distribution.html",
"https://w3f.github.io/parachain-implementers-guide/node/index.html",
"https://w3f.github.io/parachain-implementers-guide/protocol-chain-selection.html",
Expand Down
2 changes: 1 addition & 1 deletion .config/zepter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ workflows:
]
# The umbrella crate uses more features, so we to check those too:
check_umbrella:
- [ $check.0, '--features=serde,experimental,runtime,with-tracing,tuples-96,with-tracing', '-p=polkadot-sdk' ]
- [ $check.0, '--features=serde,experimental,riscv,runtime,with-tracing,tuples-96,with-tracing', '-p=polkadot-sdk' ]
# Same as `check_*`, but with the `--fix` flag.
default:
- [ $check.0, '--fix' ]
Expand Down
1 change: 1 addition & 0 deletions .github/pull_request_template.md
1 change: 1 addition & 0 deletions .github/scripts/generate-prdoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def create_prdoc(pr, audience, title, description, patch, bump, force):
# write the parsed PR documentation back to the file
with open(path, "w") as f:
yaml.dump(prdoc, f)
print(f"PrDoc for PR {pr} written to {path}")

def parse_args():
parser = argparse.ArgumentParser()
Expand Down
136 changes: 136 additions & 0 deletions .github/scripts/generate-readmes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env python3

"""
A script to generate READMEs for all public crates,
if they do not already have one.
It relies on functions from the `check-workspace.py` script.
The resulting README is based on a template defined below,
and includes the crate name, description, license,
and optionally - the SDK release version.
# Example
```sh
python3 -m pip install toml
.github/scripts/generate-readmes.py . --sdk-version 1.15.0
```
"""

import os
import toml
import importlib
import argparse

check_workspace = importlib.import_module("check-workspace")

README_TEMPLATE = """<div align="center">
<img src="https://raw.githubusercontent.com/paritytech/polkadot-sdk/master/docs/images/Polkadot_Logo_Horizontal_Pink_BlackOnWhite.png" alt="Polkadot logo" width="200">
# {name}
This crate is part of the [Polkadot SDK](https://github.com/paritytech/polkadot-sdk/).
</div>
## Description
{description}
## Additional Resources
In order to learn about Polkadot SDK, head over to the [Polkadot SDK Developer Documentation](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/index.html).
To learn about Polkadot, visit [polkadot.com](https://polkadot.com/).
## License
This crate is licensed with {license}.
"""

VERSION_TEMPLATE = """
## Version
This version of `{name}` is associated with Polkadot {sdk_version} release.
"""


def generate_readme(member, *, workspace_dir, workspace_license, sdk_version):
print(f"Loading manifest for: {member}")
manifest = toml.load(os.path.join(workspace_dir, member, "Cargo.toml"))
if manifest["package"].get("publish", True) == False:
print(f"⏩ Skipping un-published crate: {member}")
return
if os.path.exists(os.path.join(workspace_dir, member, "README.md")):
print(f"⏩ Skipping crate with an existing readme: {member}")
return
print(f"📝 Generating README for: {member}")

license = manifest["package"]["license"]
if isinstance(license, dict):
if not license.get("workspace", False):
print(
f"❌ License for {member} is unexpectedly declared as workspace=false."
)
# Skipping this crate as it is not clear what license it should use.
return
license = workspace_license

name = manifest["package"]["name"]
description = manifest["package"]["description"]
description = description + "." if not description.endswith(".") else description

filled_readme = README_TEMPLATE.format(
name=name, description=description, license=license
)

if sdk_version:
filled_readme += VERSION_TEMPLATE.format(name=name, sdk_version=sdk_version)

with open(os.path.join(workspace_dir, member, "README.md"), "w") as new_readme:
new_readme.write(filled_readme)


def parse_args():
parser = argparse.ArgumentParser(
description="Generate readmes for published crates."
)

parser.add_argument(
"workspace_dir",
help="The directory to check",
metavar="workspace_dir",
type=str,
nargs=1,
)
parser.add_argument(
"--sdk-version",
help="Optional SDK release version",
metavar="sdk_version",
type=str,
nargs=1,
required=False,
)

args = parser.parse_args()
return (args.workspace_dir[0], args.sdk_version[0] if args.sdk_version else None)


def main():
(workspace_dir, sdk_version) = parse_args()
root_manifest = toml.load(os.path.join(workspace_dir, "Cargo.toml"))
workspace_license = root_manifest["workspace"]["package"]["license"]
members = check_workspace.get_members(workspace_dir, [])
for member in members:
generate_readme(
member,
workspace_dir=workspace_dir,
workspace_license=workspace_license,
sdk_version=sdk_version,
)


if __name__ == "__main__":
main()
4 changes: 2 additions & 2 deletions .github/workflows/check-runtime-migration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ jobs:
# - network: westend
# package: westend-runtime
# wasm: westend_runtime.compact.compressed.wasm
# uri: "wss://westend-try-runtime-node.parity-chains.parity.io:443"
# uri: "wss://try-runtime-westend.polkadot.io:443"
# subcommand_extra_args: "--no-weight-warnings"
# command_extra_args: ""
# - network: rococo
# package: rococo-runtime
# wasm: rococo_runtime.compact.compressed.wasm
# uri: "wss://rococo-try-runtime-node.parity-chains.parity.io:443"
# uri: "wss://try-runtime-rococo.polkadot.io:443"
# subcommand_extra_args: "--no-weight-warnings"
# command_extra_args: ""
- network: asset-hub-westend
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/check-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,21 @@ concurrency:
env:
TOOLCHAIN: nightly-2024-06-01


jobs:
check-semver:
runs-on: ubuntu-latest
container:
image: docker.io/paritytech/ci-unified:bullseye-1.77.0-2024-04-10-v20240408
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 2

- name: extra git setup
env:
BASE: ${{ github.event.pull_request.base.sha }}
run: |
git config --global --add safe.directory '*'
git fetch --no-tags --no-recurse-submodules --depth=1 origin $BASE
git branch old $BASE
git branch old HEAD^1
- name: Comment If Backport
if: ${{ startsWith(github.event.pull_request.base.ref, 'stable') }}
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/checks-quick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ jobs:
--exclude
"substrate/frame/contracts/fixtures/build"
"substrate/frame/contracts/fixtures/contracts/common"
"substrate/frame/revive/fixtures/build"
"substrate/frame/revive/fixtures/contracts/common"
- name: deny git deps
run: python3 .github/scripts/deny-git-deps.py .
check-markdown:
Expand Down Expand Up @@ -154,3 +156,28 @@ jobs:
git diff
exit 1
fi
check-fail-ci:
runs-on: ubuntu-latest
container:
# there's no "rg" in ci-unified, and tools is a smaller image anyway
image: "paritytech/tools:latest"
# paritytech/tools uses "nonroot" user by default, which doesn't have enough
# permissions to create GHA context
options: --user root
steps:
- name: Fetch latest code
uses: actions/checkout@v4
- name: Check
run: |
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
env:
ASSERT_REGEX: "FAIL-CI"
GIT_DEPTH: 1
1 change: 1 addition & 0 deletions .github/workflows/release-30_publish_release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
uses: "./.github/workflows/release-srtool.yml"
with:
excluded_runtimes: "substrate-test bp cumulus-test kitchensink minimal-template parachain-template penpal polkadot-test seedling shell frame-try sp solochain-template"
build_opts: "--features on-chain-release-build"

build-binaries:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-50_publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@aa33708b10e362ff993539393ff100fa93ed6a27 # v3.5.0
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1

- name: Cache Docker layers
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand All @@ -322,7 +322,7 @@ jobs:
- name: Build and push
id: docker_build
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 # v6.5.0
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
with:
push: true
file: docker/dockerfiles/polkadot/polkadot_injected_debian.Dockerfile
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
inputs:
excluded_runtimes:
type: string
build_opts:
type: string
outputs:
published_runtimes:
value: ${{ jobs.find-runtimes.outputs.runtime }}
Expand Down Expand Up @@ -74,6 +76,8 @@ jobs:
- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
env:
BUILD_OPTS: ${{ inputs.build_opts }}
with:
chain: ${{ matrix.chain }}
runtime_dir: ${{ matrix.runtime_dir }}
Expand Down
24 changes: 2 additions & 22 deletions .gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ check-runtime-migration-westend:
NETWORK: "westend"
PACKAGE: "westend-runtime"
WASM: "westend_runtime.compact.compressed.wasm"
URI: "wss://westend-try-runtime-node.parity-chains.parity.io:443"
URI: "wss://try-runtime-westend.polkadot.io:443"
SUBCOMMAND_EXTRA_ARGS: "--no-weight-warnings"

check-runtime-migration-rococo:
Expand All @@ -119,29 +119,9 @@ check-runtime-migration-rococo:
NETWORK: "rococo"
PACKAGE: "rococo-runtime"
WASM: "rococo_runtime.compact.compressed.wasm"
URI: "wss://rococo-try-runtime-node.parity-chains.parity.io:443"
URI: "wss://try-runtime-rococo.polkadot.io:443"
SUBCOMMAND_EXTRA_ARGS: "--no-weight-warnings"

find-fail-ci-phrase:
stage: check
variables:
CI_IMAGE: "paritytech/tools:latest"
ASSERT_REGEX: "FAIL-CI"
GIT_DEPTH: 1
extends:
- .kubernetes-env
- .test-pr-refs
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

check-core-crypto-features:
stage: check
extends:
Expand Down
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Loading

0 comments on commit b7ce602

Please sign in to comment.