Skip to content

Commit

Permalink
Merge branch 'master' into rh-use-dyn-syncoracle
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Jul 28, 2024
2 parents ea964a9 + f5d4e92 commit 3d1c6d0
Show file tree
Hide file tree
Showing 674 changed files with 16,009 additions and 4,187 deletions.
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,with-tracing,tuples-96,with-tracing', '-p=polkadot-sdk' ]
- [ $check.0, '--features=serde,experimental,runtime,with-tracing,tuples-96,with-tracing', '-p=polkadot-sdk' ]
# Same as `check_*`, but with the `--fix` flag.
default:
- [ $check.0, '--fix' ]
Expand Down
65 changes: 65 additions & 0 deletions .github/commands-readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,36 @@ Each command will have the same two required values, but it could have more.

GitHub's official documentation: [Manually running a workflow](https://docs.github.com/en/actions/using-workflows/manually-running-a-workflow)

#### Running from CLI

You can use [`gh cli`](https://cli.github.com/) to run the commands too. Refers to the [`gh workflow run`](https://cli.github.com/manual/gh_workflow_run) section from the documentation for more information.

### Number of the Pull Request

The number of the pull request. Required so the action can fetch the correct branch and comment if it fails.

## Action configurations

### FMT

For FMT you only need the PR number.

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-fmt.yml -f pr=1000
```

### Update UI

For Update UI you only need the PR number.

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-update-ui.yml -f pr=1000
```

### Bench

Runs `benchmark pallet` or `benchmark overhead` against your PR and commits back updated weights.
Expand Down Expand Up @@ -136,6 +160,12 @@ Posible combinations based on the `benchmark` dropdown.
- Requires `Runtime Dir` to be `testing`
- Requires `Target Directory` to be `cumulus`

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-bench.yml -f pr=1000 -f benchmark=polkadot-pallet -f subcommand=pallet -f runtime=rococo -f pallet=pallet_name -f target_dir=polkadot
```

### Bench-all

This is a wrapper to run `bench` for all pallets.
Expand Down Expand Up @@ -174,6 +204,12 @@ Posible combinations based on the `benchmark` dropdown.
- `people-westend`
- Requires `Target Directory` to be `cumulus`

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-bench-all.yml -f pr=1000 -f benchmark=pallet -f pallet=pallet_name -f target_dir=polkadot -f runtime=rococo
```

### Bench-overhead

Run benchmarks overhead and commit back results to PR.
Expand All @@ -193,6 +229,35 @@ Posible combinations based on the `benchmark` dropdown.
- `asset-hub-westend`
- Requires `Target directory` to be `cumulus`

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-bench-overheard.yml -f pr=1000 -f benchmark=substrate -f runtime=rococo -f target_dir=substrate
```

### Sync

Run sync and commit back results to PR.

Posible combinations based on the `benchmark` dropdown.

- `chain`
- Requires one of the following:
- `rococo`
- `westend`
- `sync-type`
- Requires one of the following:
- `warp`
- `full`
- `fast`
- `fast-unsafe`

You can use the following [`gh cli`](https://cli.github.com/) inside the repo:

```bash
gh workflow run command-sync.yml -f pr=1000 -f chain=rococo -f sync-type=full
```

## How to modify an action

If you want to modify an action and test it, you can do by simply pushing your changes and then selecting your branch in the `Use worflow from` option.
Expand Down
8 changes: 6 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ updates:
directory: '/'
labels: ["A1-insubstantial", "R0-silent"]
schedule:
interval: daily
interval: weekly
groups:
ci_dependencies:
patterns:
- "*"
# Update Rust dependencies:
- package-ecosystem: "cargo"
directory: "/"
labels: ["A1-insubstantial", "R0-silent"]
schedule:
interval: "daily"
interval: "weekly"
groups:
# We assume these crates to be semver abiding and can therefore group them together.
known_good_semver:
Expand Down
79 changes: 79 additions & 0 deletions .github/scripts/update-wishlist-leaderboard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
from github import Github
import re
import os
from datetime import date

g = Github(os.getenv("GH_TOKEN"))

# Regex pattern to match wish format:
wish_pattern = re.compile(
r"I wish for:? (https://github\.com/([a-zA-Z0-9_.-]+)/([a-zA-Z0-9_.-]+)/issues/(\d+))"
)

wishlist_issue = g.get_repo(os.getenv("WISHLIST_REPOSITORY")).get_issue(
int(os.getenv("WISHLIST_ISSUE_NUMBER"))
)
new_leaderboard = (
"| Feature Request | Summary | Votes | Status |\n| --- | --- | --- | --- |\n"
)
wishes = {}
issue_details = {}

for comment in wishlist_issue.get_comments():
# in the comment body, if there is a string `#(\d)`, replace it with
# https://github.com/paritytech/polkadot-sdk/issues/(number)
updated_body = re.sub(
r"#(\d+)", r"https://github.com/paritytech/polkadot-sdk/issues/\1", comment.body
)

matches = wish_pattern.findall(updated_body)
for match in matches:
url, org, repo_name, issue_id = match
issue_key = (url, org, repo_name, issue_id)
if issue_key not in wishes:
wishes[issue_key] = []

# Get the author and upvoters of the wish comment.
wishes[issue_key].append(comment.user.id)
wishes[issue_key].extend(
[
reaction.user.id
for reaction in comment.get_reactions()
if reaction.content in ["+1", "heart", "rocket"]
]
)

# Get upvoters of the desired issue.
desired_issue = g.get_repo(f"{org}/{repo_name}").get_issue(int(issue_id))
wishes[issue_key].extend(
[
reaction.user.id
for reaction in desired_issue.get_reactions()
if reaction.content in ["+1", "heart", "rocket"]
]
)
issue_details[url] = [
desired_issue.title,
"👾 Open" if desired_issue.state == "open" else "✅Closed",
]

# Count unique wishes - the author of the wish, upvoters of the wish, and upvoters of the desired issue.
for key in wishes:
wishes[key] = len(list(set(wishes[key])))

# Sort wishes by count and add to the markdown table
sorted_wishes = sorted(wishes.items(), key=lambda x: x[1], reverse=True)
for (url, _, _, _), count in sorted_wishes:
[summary, status] = issue_details.get(url, "No summary available")
new_leaderboard += f"| {url} | {summary} | {count} | {status} |\n"
new_leaderboard += f"\n> Last updated: {date.today().strftime('%Y-%m-%d')}\n"
print(new_leaderboard)

new_content = re.sub(
r"(\| Feature Request \|)(.*?)(> Last updated:)(.*?\n)",
new_leaderboard,
wishlist_issue.body,
flags=re.DOTALL,
)

wishlist_issue.edit(body=new_content)
4 changes: 2 additions & 2 deletions .github/workflows/check-licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/[email protected].1
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/[email protected].3
with:
node-version: "18.x"
registry-url: "https://npm.pkg.github.com"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Restore lychee cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3.3.2 (7. Sep 2023)
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v3.3.2 (7. Sep 2023)
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
# This should restore from the most recent one:
restore-keys: cache-lychee-

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.0 (22. Sep 2023)
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.0 (22. Sep 2023)

- name: Lychee link checker
uses: lycheeverse/lychee-action@c3089c702fbb949e3f7a8122be0c33c017904f9b # for v1.9.1 (10. Jan 2024)
uses: lycheeverse/lychee-action@2b973e86fc7b1f6b36a93795fe2c9c6ae1118621 # for v1.9.1 (10. Jan 2024)
with:
args: >-
--config .config/lychee.toml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-prdoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
if: github.event.pull_request.number != ''
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 #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
Expand Down
67 changes: 55 additions & 12 deletions .github/workflows/check-semver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,85 @@ on:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- prdoc/*.prdoc
workflow_dispatch:

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

env:
TOOLCHAIN: nightly-2024-03-01
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: extra git setup
run: |
git config --global --add safe.directory '*'
git fetch --no-tags --no-recurse-submodules --depth=1 origin master
git branch old origin/master
- name: Comment If Backport
if: ${{ startsWith(github.event.pull_request.base.ref, 'stable') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.number }}
run: |
echo "This is a backport into stable."
wget -q https://github.com/cli/cli/releases/download/v2.51.0/gh_2.51.0_linux_amd64.tar.gz -O gh.tar.gz && \
tar -xzf gh.tar.gz && mv gh_2.51.0_linux_amd64/bin/gh /usr/local/bin/gh && rm gh.tar.gz
chmod +x /usr/local/bin/gh
cat > msg.txt <<EOF
This pull request is amending an existing release. Please proceed with extreme caution,
as to not impact downstream teams that rely on the stability of it. Some things to consider:
- Backports are only for 'patch' or 'minor' changes. No 'major' or other breaking change.
- Should be a legit *fix* for some bug, not adding tons of new features.
- Must either be already audited or trivial (not sure audit).
<details><summary><i>Emergency Bypass</i></summary>
<p>
If you really need to bypass this check: add <code>validate: false</code> to each crate
in the Prdoc where a breaking change is introduced. This will release a new major
version of that crate and all its reverse dependencies and basically break the release.
</p>
</details>
EOF
gh issue comment $PR --edit-last -F msg.txt || gh issue comment $PR -F msg.txt
echo "PRDOC_EXTRA_ARGS=--max-bump minor" >> $GITHUB_ENV
- name: Rust Cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
cache-on-failure: true

- name: install parity-publish
run: cargo install [email protected]

- name: Rust compilation prerequisites
run: |
rustup default $TOOLCHAIN
rustup target add wasm32-unknown-unknown --toolchain $TOOLCHAIN
rustup component add rust-src --toolchain $TOOLCHAIN
- name: extra git setup
run: |
git config --global --add safe.directory '*'
git fetch --no-tags --no-recurse-submodules --depth=1 origin master
git branch old origin/master
- name: install parity-publish
# Set the target dir to cache the build.
run: CARGO_TARGET_DIR=./target/ cargo install parity-publish -q

- name: check semver
run: |
export CARGO_TARGET_DIR=target
export RUSTFLAGS='-A warnings -A missing_docs'
export SKIP_WASM_BUILD=1
if ! parity-publish --color always prdoc --since old --validate prdoc/pr_$PR.prdoc -v --toolchain $TOOLCHAIN; then
if ! parity-publish --color always prdoc --since old --validate prdoc/pr_$PR.prdoc $PRDOC_EXTRA_ARGS -v --toolchain $TOOLCHAIN; then
cat <<EOF
👋 Hello developer! The SemVer information that you declared in the prdoc file did not match what the CI detected.
Expand All @@ -56,3 +98,4 @@ jobs:
fi
env:
PR: ${{ github.event.pull_request.number }}
PRDOC_EXTRA_ARGS: ${{ env.PRDOC_EXTRA_ARGS }}
Loading

0 comments on commit 3d1c6d0

Please sign in to comment.