Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into kiz-update-polkadot-i…
Browse files Browse the repository at this point in the history
…nflation
  • Loading branch information
bkchr committed Oct 19, 2023
2 parents 5fbfdab + 1dc04eb commit a2de53c
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 23 deletions.
65 changes: 65 additions & 0 deletions .github/changelog-processor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/usr/bin/env python

import os
import sys
import argparse

parser = argparse.ArgumentParser(description="Process the CHANGELOG.md")
parser.add_argument(
"changelog",
metavar="CHANGELOG",
help="Path to the CHANGELOG.md file",
default="CHANGELOG.md",
nargs='?'
)

group = parser.add_mutually_exclusive_group()
group.add_argument(
"--print-latest-version",
dest="print_latest_version",
help="Print the latest version (first in the file) found in the CHANGELOG.md",
action="store_true"
)
group.add_argument(
"--should-release",
dest="should_release",
help="Should a release be made? Prints `1` or `0`.",
action="store_true"
)

args = parser.parse_args()

with open(args.changelog, "r") as changelog:
lines = changelog.readlines()

# Find the latest version
for line in lines:
if not line.startswith("## ["):
continue

version = line.strip().removeprefix("## [").split("]")[0]
break

if args.print_latest_version:
print(version, end = "")
sys.exit(0)
elif args.should_release:
if version.lower() == "unreleased":
print("0", end = "")
sys.exit(-1)
elif version.count(".") != 2:
print("0", end = "")
sys.exit(-1)

stream = os.popen("git tag -l v" + version)
output = stream.read()

# Empty output means that the tag doesn't exist and that we should release.
if output.strip() == "":
print("1", end = "")
else:
print("0", end = "")

sys.exit(0)
else:
parser.print_help()
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- Remember that you can run `/merge` to enable auto-merge in the PR -->
22 changes: 22 additions & 0 deletions .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Auto Merge Bot

on:
# GitHub considers PRs as issues
issue_comment:
types: [created]

jobs:
set-auto-merge:
runs-on: ubuntu-latest
# Important! This forces the job to run only on comments on Pull Requests that starts with '/merge'
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/merge') }}
steps:
- name: Get the GitHub handle of the fellows
uses: paritytech/[email protected]
id: fellows
- name: Set auto merge
uses: paritytech/[email protected]
with:
GITHUB_TOKEN: '${{ github.token }}'
MERGE_METHOD: "SQUASH"
ALLOWLIST: ${{ steps.fellows.outputs.github-handles }}
29 changes: 21 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,21 @@ on:
workflow_dispatch:

jobs:
collect-release-information:
runs-on: ubuntu-latest
outputs:
should-release: ${{ steps.run.outputs.should-release }}
version: ${{ steps.run.outputs.version }}
steps:
- uses: actions/checkout@v2
- id: run
run: |
echo "should-release=$(.github/changelog-processor.py CHANGELOG.md --should-release)" >> $GITHUB_OUTPUT
echo "version=$(.github/changelog-processor.py CHANGELOG.md --print-latest-version)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
runtime-matrix:
needs: [ collect-release-information ]
if: needs.collect-release-information.outputs.should-release == '1'
runs-on: ubuntu-latest
outputs:
runtime: ${{ steps.runtime.outputs.runtime }}
Expand Down Expand Up @@ -66,9 +80,9 @@ jobs:
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
publish-draft-release:
publish-release:
runs-on: ubuntu-latest
needs: [ build-runtimes ]
needs: [ build-runtimes, collect-release-information ]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
Expand All @@ -92,7 +106,6 @@ jobs:
SRTOOL() { <$(<<<$CONTEXT head -n1) jq -r .$1; }
WASM() { <${JSON} jq -r ".runtimes.compressed.subwasm.$1"; }
tee -a DRAFT <<-EOF
## Changelog
EOF
tee -a DRAFT <CHANGELOG.md
tee -a DRAFT <<-EOF
Expand All @@ -115,19 +128,19 @@ jobs:
EOF
done
- name: Create draft release
- name: Create release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Runtimes ${{ github.sha }}
tag_name: ${{ format('v{0}', needs.collect-release-information.outputs.version) }}
release_name: Runtimes ${{ needs.collect-release-information.outputs.version }}
body_path: DRAFT
draft: true
draft: false

publish-runtimes:
needs: [ runtime-matrix, publish-draft-release ]
needs: [ runtime-matrix, publish-release ]
continue-on-error: true
runs-on: ubuntu-latest
env:
Expand Down
24 changes: 13 additions & 11 deletions .github/workflows/review-bot.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
name: Review PR
name: Review Bot

on:
pull_request_target:
workflow_run:
workflows:
- Review-Trigger
types:
- opened
- reopened
- synchronize
- review_requested
- review_request_removed
- ready_for_review
pull_request_review:
- completed

permissions:
contents: read
checks: write

jobs:
review-approvals:
runs-on: ubuntu-latest
steps:
- name: Extract content of artifact
id: number
uses: Bullrich/[email protected]
with:
artifact-name: pr_number
- name: Generate token
id: team_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.REVIEW_APP_ID }}
private_key: ${{ secrets.REVIEW_APP_KEY }}
- name: "Evaluates PR reviews and assigns reviewers"
uses: paritytech/review-bot@v2.0.0
uses: paritytech/review-bot@v2.1.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
team-token: ${{ steps.team_token.outputs.token }}
checks-token: ${{ steps.team_token.outputs.token }}
pr-number: ${{ steps.number.outputs.content }}
31 changes: 31 additions & 0 deletions .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Review-Trigger

on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- review_requested
- review_request_removed
- ready_for_review
pull_request_review:

jobs:
trigger-review-bot:
runs-on: ubuntu-latest
name: trigger review bot
steps:
- name: Get PR number
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
echo "Saving PR number: $PR_NUMBER"
mkdir -p ./pr
echo $PR_NUMBER > ./pr/pr_number
- uses: actions/upload-artifact@v3
name: Save PR number
with:
name: pr_number
path: pr/
retention-days: 5
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

Changelog for the runtimes governed by the Polkadot Fellowship.

## [1.0.0]
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Changed

Expand Down Expand Up @@ -39,4 +41,7 @@ Changelog for the runtimes governed by the Polkadot Fellowship.
- XCM: Fix issue with RequestUnlock ([paritytech/polkadot#7278](https://github.com/paritytech/polkadot/pull/7278))
- Clear Existing HRMP Channel Request When Force Opening ([paritytech/polkadot#7389](https://github.com/paritytech/polkadot/pull/7389))
- Prune upgrade cooldowns ([paritytech/polkadot#7470](https://github.com/paritytech/polkadot/pull/7470))
- Assets `destroy_accounts` releases the deposit ([paritytech/substrate#14443](https://github.com/paritytech/substrate/pull/14443))
- Assets `destroy_accounts` releases the deposit
([paritytech/substrate#14443](https://github.com/paritytech/substrate/pull/14443))
- Update Polkadot Collectives to use `limited_teleport_assets` for automatic slash handling, as
`teleport_assets` is deprecated and caused a failing integration test. ([polkadot-fellows/runtimes#46](https://github.com/polkadot-fellows/runtimes/pull/46))
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,26 @@ Each leaf folder contains one runtime crate:
└── gluttons
└── glutton-kusama
```

# Working on Pull Requests

To merge a pull request, we use [Auto Merge Bot](https://github.com/paritytech/auto-merge-bot).

To use it, write a comment in a PR that says:

> `/merge`
This will enable [`auto-merge`](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) in the Pull Request (or merge it if it is ready to merge).

The automation can be triggered by the author of the PR or any fellow whose GitHub handle is part of their identity.

# Release process

Releases are automatically pushed on commits merged to master that fulfill the following requirements:

- The [`CHANGELOG.md`](CHANGELOG.md) file was modified.
- The latest version (the version at the top of the file) in [`CHANGELOG.md`](CHANGELOG.md) has no tag in the repository.

The release process is building all runtimes and then puts them into a release in this github repository.

The format of [`CHANGELOG.md`](CHANGELOG.md) is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use pallet_alliance::{ProposalIndex, ProposalProvider};
use parachains_common::impls::NegativeImbalance;
use sp_runtime::DispatchError;
use sp_std::{cmp::Ordering, marker::PhantomData, prelude::*};
use xcm::latest::{Fungibility, Junction, Parent};
use xcm::latest::{Fungibility, Junction, Parent, WeightLimit};

type AccountIdOf<T> = <T as frame_system::Config>::AccountId;

Expand Down Expand Up @@ -63,7 +63,7 @@ where

<pallet_balances::Pallet<T>>::resolve_creating(&pallet_acc, amount);

let result = <pallet_xcm::Pallet<T>>::teleport_assets(
let result = <pallet_xcm::Pallet<T>>::limited_teleport_assets(
<<T as frame_system::Config>::RuntimeOrigin>::signed(pallet_acc.into()),
Box::new(Parent.into()),
Box::new(
Expand All @@ -73,6 +73,7 @@ where
),
Box::new((Parent, imbalance).into()),
0,
WeightLimit::Unlimited,
);

if let Err(err) = result {
Expand Down

0 comments on commit a2de53c

Please sign in to comment.