-
Notifications
You must be signed in to change notification settings - Fork 766
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'george/restore-gav-tx-ext' into gui-check-metadata-hash…
…-benchmarks
- Loading branch information
Showing
386 changed files
with
11,098 additions
and
7,908 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: 'cargo check runtimes' | ||
description: 'Runs `cargo check` for every directory in provided root.' | ||
inputs: | ||
root: | ||
description: "Root directory. Expected to contain several cargo packages inside." | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Check | ||
shell: bash | ||
run: | | ||
mkdir -p ~/.forklift | ||
cp .forklift/config.toml ~/.forklift/config.toml | ||
cd ${{ inputs.root }} | ||
for directory in $(echo */); do | ||
echo "_____Running cargo check for ${directory} ______"; | ||
cd ${directory}; | ||
pwd; | ||
SKIP_WASM_BUILD=1 forklift cargo check --locked; | ||
cd ..; | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#!/usr/bin/env python3 | ||
|
||
""" | ||
Generate the PrDoc for a Pull Request with a specific number, audience and bump level. | ||
It downloads and parses the patch from the GitHub API to opulate the prdoc with all modified crates. | ||
This will delete any prdoc that already exists for the PR if `--force` is passed. | ||
Usage: | ||
python generate-prdoc.py --pr 1234 --audience "TODO" --bump "TODO" | ||
""" | ||
|
||
import argparse | ||
import os | ||
import re | ||
import sys | ||
import subprocess | ||
import toml | ||
import yaml | ||
import requests | ||
|
||
from github import Github | ||
import whatthepatch | ||
from cargo_workspace import Workspace | ||
|
||
# Download the patch and pass the info into `create_prdoc`. | ||
def from_pr_number(n, audience, bump, force): | ||
print(f"Fetching PR '{n}' from GitHub") | ||
g = Github() | ||
|
||
repo = g.get_repo("paritytech/polkadot-sdk") | ||
pr = repo.get_pull(n) | ||
|
||
patch_url = pr.patch_url | ||
patch = requests.get(patch_url).text | ||
|
||
create_prdoc(n, audience, pr.title, pr.body, patch, bump, force) | ||
|
||
def create_prdoc(pr, audience, title, description, patch, bump, force): | ||
path = f"prdoc/pr_{pr}.prdoc" | ||
|
||
if os.path.exists(path): | ||
if force == True: | ||
print(f"Overwriting existing PrDoc for PR {pr}") | ||
else: | ||
print(f"PrDoc already exists for PR {pr}. Use --force to overwrite.") | ||
sys.exit(1) | ||
else: | ||
print(f"No preexisting PrDoc for PR {pr}") | ||
|
||
prdoc = { "doc": [{}], "crates": [] } | ||
|
||
prdoc["title"] = title | ||
prdoc["doc"][0]["audience"] = audience | ||
prdoc["doc"][0]["description"] = description | ||
|
||
workspace = Workspace.from_path(".") | ||
|
||
modified_paths = [] | ||
for diff in whatthepatch.parse_patch(patch): | ||
modified_paths.append(diff.header.new_path) | ||
|
||
modified_crates = {} | ||
for p in modified_paths: | ||
# Go up until we find a Cargo.toml | ||
p = os.path.join(workspace.path, p) | ||
while not os.path.exists(os.path.join(p, "Cargo.toml")): | ||
p = os.path.dirname(p) | ||
|
||
with open(os.path.join(p, "Cargo.toml")) as f: | ||
manifest = toml.load(f) | ||
|
||
if not "package" in manifest: | ||
print(f"File was not in any crate: {p}") | ||
continue | ||
|
||
crate_name = manifest["package"]["name"] | ||
if workspace.crate_by_name(crate_name).publish: | ||
modified_crates[crate_name] = True | ||
else: | ||
print(f"Skipping unpublished crate: {crate_name}") | ||
|
||
print(f"Modified crates: {modified_crates.keys()}") | ||
|
||
for crate_name in modified_crates.keys(): | ||
entry = { "name": crate_name } | ||
|
||
if bump == 'silent' or bump == 'ignore' or bump == 'no change': | ||
entry["validate"] = False | ||
else: | ||
entry["bump"] = bump | ||
|
||
print(f"Adding crate {entry}") | ||
prdoc["crates"].append(entry) | ||
|
||
# write the parsed PR documentation back to the file | ||
with open(path, "w") as f: | ||
yaml.dump(prdoc, f) | ||
|
||
def parse_args(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--pr", type=int, required=True) | ||
parser.add_argument("--audience", type=str, default="TODO") | ||
parser.add_argument("--bump", type=str, default="TODO") | ||
parser.add_argument("--force", type=str) | ||
return parser.parse_args() | ||
|
||
if __name__ == "__main__": | ||
args = parse_args() | ||
force = True if args.force.lower() == "true" else False | ||
print(f"Args: {args}, force: {force}") | ||
from_pr_number(args.pr, args.audience, args.bump, force) |
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,136 @@ | ||
name: Check Cargo Check Runtimes | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, synchronize, reopened, ready_for_review, labeled ] | ||
|
||
|
||
# Jobs in this workflow depend on each other, only for limiting peak amount of spawned workers | ||
|
||
jobs: | ||
# GitHub Actions allows using 'env' in a container context. | ||
# However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322 | ||
# This workaround sets the container image for each job using 'set-image' job output. | ||
set-image: | ||
if: contains(github.event.label.name, 'GHA-migration') || contains(github.event.pull_request.labels.*.name, 'GHA-migration') | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
outputs: | ||
IMAGE: ${{ steps.set_image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- id: set_image | ||
run: cat .github/env >> $GITHUB_OUTPUT | ||
check-runtime-assets: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
needs: [set-image] | ||
timeout-minutes: 20 | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/assets | ||
|
||
check-runtime-collectives: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
needs: [check-runtime-assets, set-image] | ||
timeout-minutes: 20 | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/collectives | ||
|
||
check-runtime-coretime: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
needs: [check-runtime-assets, set-image] | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/coretime | ||
|
||
check-runtime-bridge-hubs: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
needs: [set-image] | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/bridge-hubs | ||
|
||
check-runtime-contracts: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
needs: [check-runtime-collectives, set-image] | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/contracts | ||
|
||
check-runtime-starters: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
needs: [check-runtime-assets, set-image] | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/starters | ||
|
||
check-runtime-testing: | ||
runs-on: arc-runners-polkadot-sdk-beefy | ||
container: | ||
image: ${{ needs.set-image.outputs.IMAGE }} | ||
needs: [check-runtime-starters, set-image] | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Run cargo check | ||
uses: ./.github/actions/cargo-check-runtimes | ||
with: | ||
root: cumulus/parachains/runtimes/testing | ||
|
||
confirm-required-jobs-passed: | ||
runs-on: ubuntu-latest | ||
name: All check-runtime-* tests passed | ||
# If any new job gets added, be sure to add it to this array | ||
needs: | ||
- check-runtime-assets | ||
- check-runtime-collectives | ||
- check-runtime-coretime | ||
- check-runtime-bridge-hubs | ||
- check-runtime-contracts | ||
- check-runtime-starters | ||
- check-runtime-testing | ||
steps: | ||
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.