-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into ao-collator-parent-…
…head-data * origin/master: (51 commits) Runtime Upgrade ref docs and Single Block Migration example pallet (#1554) Collator overseer builder unification (#3335) Introduce storage attr macro `#[disable_try_decode_storage]` and set it on `System::Events` and `ParachainSystem::HostConfiguration` (#3454) Add Polkadotters bootnoders per IBP application (#3423) Add documentation around FRAME Origin (#3362) Bridge zombienet tests: Check amount received at destination (#3490) Snowbridge benchmark tests fix (#3424) fix(zombienet): increase timeout in download artifacts (#3376) Cleanup String::from_utf8 (#3446) [prdoc] Validate crate names (#3467) Limit max execution time for `test-linux-stable` CI jobs (#3483) Introduce Notification block pinning limit (#2935) frame-support: Improve error reporting when having too many pallets (#3478) add Encointer as trusted teleporter for Westend (#3411) [pallet-xcm] Adjust benchmarks (teleport_assets/reserve_transfer_assets) not relying on ED (#3464) Add more debug logs to understand if statement-distribution misbehaving (#3419) Remove redundant parachains assigner pallet. (#3457) Use generic hash for runtime wasm in resolve_state_version_from_wasm (#3447) Runtime: allow backing multiple candidates of same parachain on different cores (#3231) Bridge zombienet tests: move all "framework" files under one folder (#3462) ...
- Loading branch information
Showing
581 changed files
with
9,355 additions
and
3,522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env python3 | ||
|
||
''' | ||
Ensure that the prdoc files are valid. | ||
# Example | ||
```sh | ||
python3 -m pip install cargo-workspace | ||
python3 .github/scripts/check-prdoc.py Cargo.toml prdoc/*.prdoc | ||
``` | ||
Produces example output: | ||
```pre | ||
🔎 Reading workspace polkadot-sdk/Cargo.toml | ||
📦 Checking 32 prdocs against 493 crates. | ||
✅ All prdocs are valid | ||
``` | ||
''' | ||
|
||
import os | ||
import yaml | ||
import argparse | ||
import cargo_workspace | ||
|
||
def check_prdoc_crate_names(root, paths): | ||
''' | ||
Check that all crates of the `crates` section of each prdoc is present in the workspace. | ||
''' | ||
|
||
print(f'🔎 Reading workspace {root}.') | ||
workspace = cargo_workspace.Workspace.from_path(root) | ||
crate_names = [crate.name for crate in workspace.crates] | ||
|
||
print(f'📦 Checking {len(paths)} prdocs against {len(crate_names)} crates.') | ||
faulty = {} | ||
|
||
for path in paths: | ||
with open(path, 'r') as f: | ||
prdoc = yaml.safe_load(f) | ||
|
||
for crate in prdoc.get('crates', []): | ||
crate = crate['name'] | ||
if crate in crate_names: | ||
continue | ||
|
||
faulty.setdefault(path, []).append(crate) | ||
|
||
if len(faulty) == 0: | ||
print('✅ All prdocs are valid.') | ||
else: | ||
print('❌ Some prdocs are invalid.') | ||
for path, crates in faulty.items(): | ||
print(f'💥 {path} lists invalid crate: {", ".join(crates)}') | ||
exit(1) | ||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser(description='Check prdoc files') | ||
parser.add_argument('root', help='The cargo workspace manifest', metavar='root', type=str, nargs=1) | ||
parser.add_argument('prdoc', help='The prdoc files', metavar='prdoc', type=str, nargs='*') | ||
args = parser.parse_args() | ||
|
||
if len(args.prdoc) == 0: | ||
print('❌ Need at least one prdoc file as argument.') | ||
exit(1) | ||
|
||
return { 'root': os.path.abspath(args.root[0]), 'prdocs': args.prdoc } | ||
|
||
if __name__ == '__main__': | ||
args = parse_args() | ||
check_prdoc_crate_names(args['root'], args['prdocs']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.