Skip to content

Commit

Permalink
Merge branch 'main' into ci-cancel-old-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
bkchr authored Jun 29, 2024
2 parents de27ca3 + 750aa73 commit ba9985f
Show file tree
Hide file tree
Showing 296 changed files with 18,142 additions and 5,891 deletions.
46 changes: 23 additions & 23 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
# RUSTFLAGS= cargo clippy
[target.'cfg(feature = "cargo-clippy")']
rustflags = [
"-Aclippy::all",
"-Dclippy::correctness",
"-Aclippy::if-same-then-else",
"-Asuspicious_double_ref_op",
"-Dclippy::complexity",
"-Aclippy::zero-prefixed-literal", # 00_1000_000
"-Aclippy::type_complexity", # raison d'etre
"-Aclippy::nonminimal-bool", # maybe
"-Aclippy::borrowed-box", # Reasonable to fix this one
"-Aclippy::too-many-arguments", # (Turning this on would lead to)
"-Aclippy::unnecessary_cast", # Types may change
"-Aclippy::identity-op", # One case where we do 0 +
"-Aclippy::useless_conversion", # Types may change
"-Aclippy::unit_arg", # styalistic.
"-Aclippy::option-map-unit-fn", # styalistic
"-Aclippy::bind_instead_of_map", # styalistic
"-Aclippy::erasing_op", # E.g. 0 * DOLLARS
"-Aclippy::eq_op", # In tests we test equality.
"-Aclippy::while_immutable_condition", # false positives
"-Aclippy::needless_option_as_deref", # false positives
"-Aclippy::derivable_impls", # false positives
"-Aclippy::stable_sort_primitive", # prefer stable sort
"-Aclippy::extra-unused-type-parameters", # stylistic
"-Aclippy::all",
"-Aclippy::bind_instead_of_map", # stylistic
"-Aclippy::borrowed-box", # Reasonable to fix this one
"-Aclippy::derivable_impls", # false positives
"-Aclippy::eq_op", # In tests we test equality.
"-Aclippy::erasing_op", # E.g. 0 * DOLLARS
"-Aclippy::extra-unused-type-parameters", # stylistic
"-Aclippy::identity-op", # One case where we do 0 +
"-Aclippy::if-same-then-else",
"-Aclippy::needless_option_as_deref", # false positives
"-Aclippy::nonminimal-bool", # maybe
"-Aclippy::option-map-unit-fn", # stylistic
"-Aclippy::stable_sort_primitive", # prefer stable sort
"-Aclippy::too-many-arguments", # (Turning this on would lead to)
"-Aclippy::type_complexity", # raison d'etre
"-Aclippy::unit_arg", # stylistic
"-Aclippy::unnecessary_cast", # Types may change
"-Aclippy::useless_conversion", # Types may change
"-Aclippy::while_immutable_condition", # false positives
"-Aclippy::zero-prefixed-literal", # 00_1000_000
"-Asuspicious_double_ref_op",
"-Dclippy::complexity",
"-Dclippy::correctness",
]
29 changes: 29 additions & 0 deletions .config/taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# all options https://taplo.tamasfe.dev/configuration/formatter-options.html

exclude = [
"target/**",
]

# global rules
[formatting]
reorder_arrays = true
inline_table_expand = false
array_auto_expand = false
array_auto_collapse = false
indent_string = " " # tab

# don't re-order order-dependent deb package metadata
[[rule]]
include = ["polkadot/Cargo.toml"]
keys = ["package.metadata.deb"]

[rule.formatting]
reorder_arrays = false

# don't re-order order-dependent rustflags
[[rule]]
include = [".cargo/config.toml"]
keys = ["build"]

[rule.formatting]
reorder_arrays = false
4 changes: 2 additions & 2 deletions .github/env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
RUST_STABLE_VERSION=1.76.0
RUST_NIGHTLY_VERSION=2024-03-14
RUST_STABLE_VERSION=1.77.0
RUST_NIGHTLY_VERSION=2024-04-14
2 changes: 1 addition & 1 deletion .github/workflows/auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/merge') }}
steps:
- name: Get the GitHub handle of the fellows
uses: paritytech/get-fellows-action@v1.1.0
uses: paritytech/get-fellows-action@v1.1.3
id: fellows
- name: Generate a token
id: merge_token
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/check-features.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ jobs:
fetch-depth: 0 # Dont clone historic commits.

- name: Check features
run: zepter run check
run: |
zepter run check
# We will add this to the config file once its stabilized. Just run it in the CI for now.
zepter transpose dep lift-to-workspace 'regex:.*'
18 changes: 18 additions & 0 deletions .github/workflows/check-migrations.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Check Migrations

# If you modify more jobs, ensure that you add them as required to the job "confirmMigrationsPassed"
# which is located at the end of this file (more info in the job)

on:
push:
branches: ["main", "release-*"]
Expand All @@ -16,6 +19,7 @@ concurrency:
permissions: {}

jobs:
# This generates a matrix with all the required jobs which will be run in the next step
runtime-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -36,6 +40,8 @@ jobs:
TASKS=$(echo $TASKS | jq -c .)
echo "runtime=$TASKS" >> $GITHUB_OUTPUT
# This runs all the jobs in the matrix. It is required by the "confirmMigrationsPassed" job, so
# if they all pass, that job will pass too.
check-migrations:
needs: [runtime-matrix]
continue-on-error: true
Expand Down Expand Up @@ -77,3 +83,15 @@ jobs:
node-uri: ${{ matrix.runtime.uri }}
checks: "pre-and-post"
extra-args: ${{ env.EXTRA_ARGS }}

# This will only run if all the tests in its "needs" array passed.
# Add this as your required job, becuase if the matrix changes size (new things get added)
# it will still require all the steps to succeed.
# If you add more jobs, remember to add them to the "needs" array.
confirmMigrationsPassed:
runs-on: ubuntu-latest
name: All migrations passed
# If any new job gets added, be sure to add it to this array
needs: [check-migrations]
steps:
- run: echo '### Good job! All the migrations passed 🚀' >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ jobs:
- name: Clippy
run: cargo +nightly-$RUST_NIGHTLY_VERSION clippy --all-targets --locked -q
env:
RUSTFLAGS: "-D warnings"
SKIP_WASM_BUILD: 1
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"name": "people-kusama",
"package": "people-kusama-integration-tests"
},
{
"name": "people-polkadot",
"package": "people-polkadot-integration-tests"
},
{
"name": "collectives-polkadot",
"package": "collectives-polkadot-integration-tests"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/review-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
artifact-name: pr_number
- name: Generate token
id: team_token
uses: tibdex/github-app-token@v1
uses: actions/create-github-app-token@v1.9.3
with:
app_id: ${{ secrets.REVIEW_APP_ID }}
private_key: ${{ secrets.REVIEW_APP_KEY }}
app-id: ${{ secrets.REVIEW_APP_ID }}
private-key: ${{ secrets.REVIEW_APP_KEY }}
- name: "Evaluates PR reviews and assigns reviewers"
uses: paritytech/review-bot@v2.4.0
uses: paritytech/review-bot@v2.4.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
team-token: ${{ steps.team_token.outputs.token }}
Expand Down
43 changes: 42 additions & 1 deletion .github/workflows/review-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,58 @@ on:

jobs:
trigger-review-bot:
# (It is not a draft) && (it is not a review || it is an approving review)
if: ${{ github.event.pull_request.draft != true && (github.event_name != 'pull_request_review' || (github.event.review && github.event.review.state == 'APPROVED')) }}
runs-on: ubuntu-latest
name: trigger review bot
steps:
- name: Get PR data
id: comments
run: |
echo "bodies=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '[.comments[].body]')" >> "$GITHUB_OUTPUT"
echo "reviews=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews --jq '[.[].state]')" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Get the GitHub handle of the fellows
uses: paritytech/get-fellows-action@v1.1.3
id: fellows
# Require new reviews when the author is pushing and he is not a fellow
- name: Fail when author pushes new code
# if (contains approved reviews && it's a synchronize event && was triggered by the author (who is not a fellow))
if: |
contains(fromJson(steps.comments.outputs.reviews), 'APPROVED') &&
github.event_name == 'pull_request_target' &&
github.event.action == 'synchronize' &&
github.event.sender.login == github.event.pull_request.user.login &&
contains(steps.fellows.outputs.github-handles, github.event.pull_request.user.login)
run: |
# We get the list of reviewers who approved the PR
REVIEWERS=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
--jq '{reviewers: [.[] | select(.state == "APPROVED") | .user.login]}')
# We request them to review again
echo $REVIEWERS | gh api --method POST repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/requested_reviewers --input -
echo "::error::Project needs to be reviewed again"
exit 1
env:
GH_TOKEN: ${{ github.token }}
- name: Comment requirements
# If the previous step failed and github-actions hasn't commented yet we comment instructions
if: failure() && !contains(fromJson(steps.comments.outputs.bodies), 'Review required! Latest push from author must always be reviewed')
run: |
gh pr comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "Review required! Latest push from author must always be reviewed"
env:
GH_TOKEN: ${{ github.token }}
COMMENTS: ${{ steps.comments.outputs.users }}
- 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
- uses: actions/upload-artifact@v4
name: Save PR number
with:
name: pr_number
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/runtimes-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"name": "coretime-kusama",
"package": "coretime-kusama-runtime",
"path": "system-parachains/coretime/coretime-kusama",
"uri": "wss://kusama-coretime-rpc.polkadot.io:443",
"is_relay": false
},
{
Expand All @@ -66,6 +67,12 @@
"path": "system-parachains/people/people-kusama",
"is_relay": false
},
{
"name": "people-polkadot",
"package": "people-polkadot-runtime",
"path": "system-parachains/people/people-polkadot",
"is_relay": false
},
{
"name": "encointer-kusama",
"package": "encointer-kusama-runtime",
Expand Down
79 changes: 77 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: "Test all features"

# If you modify more test jobs, ensure that you add them as required to the job "confirmTestPassed"
# which is located at the end of this file (more info in the job)

on:
push:
branches: ["main", "release-*"]
Expand All @@ -12,6 +15,7 @@ concurrency:
cancel-in-progress: true

jobs:
# This generates a matrix with all the required jobs which will be run in the next step
runtime-matrix:
runs-on: ubuntu-latest
outputs:
Expand All @@ -38,6 +42,7 @@ jobs:
echo $TASKS
echo "itest=$TASKS" >> $GITHUB_OUTPUT
# Job required by "confirmTestPassed"
runtime-test:
needs: [runtime-matrix]
continue-on-error: true
Expand Down Expand Up @@ -79,16 +84,17 @@ jobs:
shared-key: "fellowship-cache-tests"

- name: Test ${{ matrix.runtime.name }}
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q --features=try-runtime
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q
env:
RUSTFLAGS: "-C debug-assertions -D warnings"

- name: Test all features ${{ matrix.runtime.name }}
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q --features=runtime-benchmarks,try-runtime
run: cargo test -p ${{ matrix.runtime.package }} --release --locked -q --all-features
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1

# Job required by "confirmTestPassed"
integration-test:
needs: [integration-test-matrix]
continue-on-error: true
Expand Down Expand Up @@ -139,6 +145,7 @@ jobs:
env:
RUSTFLAGS: "-C debug-assertions -D warnings"

# Job required by "confirmTestPassed"
build-chain-spec-generator:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -184,3 +191,71 @@ jobs:
env:
RUSTFLAGS: "-C debug-assertions -D warnings"
SKIP_WASM_BUILD: 1

# Job required by "confirmTestPassed"
zombienet-smoke:
needs: [build-chain-spec-generator]
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@b173b6ec0100793626c2d9e6b90435061f4fc3e5 # v0.11.0
with:
access_token: ${{ github.token }}

- name: Install updates and protobuf-compiler
run: sudo apt update && sudo apt install --assume-yes cmake protobuf-compiler

- name: Free space on the runner
run: |
df -h
sudo apt -y autoremove --purge
sudo apt -y autoclean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout
uses: actions/checkout@v3

- name: Set rust version via common env file
run: cat .github/env >> $GITHUB_ENV

- name: Install stable toolchain
run: |
rustup install $RUST_STABLE_VERSION
rustup default $RUST_STABLE_VERSION
rustup target add wasm32-unknown-unknown
rustup component add rust-src
- name: Fetch cache
uses: Swatinem/rust-cache@a95ba195448af2da9b00fb742d14ffaaf3c21f43 # v2.7.0
with:
shared-key: "fellowship-cache-integration-tests"

- name: Build
run: |
cargo build -p chain-spec-generator --features fast-runtime --release --locked
- name: Zombienet smoke test
timeout-minutes: 20
run: |
export PATH=$(pwd)/target/release:$PATH
cargo test --manifest-path integration-tests/zombienet/Cargo.toml
# This will only run if all the tests in its "needs" array passed.
# Add this as your required job, becuase if the matrix changes size (new things get added)
# it will still require all the steps to succeed.
# If you add more jobs, remember to add them to the "needs" array.
confirmTestPassed:
runs-on: ubuntu-latest
name: All tests passed
# If any new job gets added, be sure to add it to this list
needs:
- runtime-test
- integration-test
- build-chain-spec-generator
- zombienet-smoke
steps:
- run: echo '### Good job! All the tests passed 🚀' >> $GITHUB_STEP_SUMMARY
Loading

0 comments on commit ba9985f

Please sign in to comment.