Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CONTRIBUTING.md #44

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 44 additions & 4 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,47 @@ jobs:
echo "RUNNER=ubuntu-latest" >> $GITHUB_OUTPUT
fi

cmd:
# Get PR branch name, because the issue_comment event does not contain the PR branch name
get-pr-branch:
needs: [ set-image ]
runs-on: ubuntu-latest
outputs:
pr-branch: ${{ steps.get-pr.outputs.pr_branch }}
repo: ${{ steps.get-pr.outputs.repo }}
steps:
- name: Check if the issue is a PR
id: check-pr
run: |
if [ -n "${{ github.event.issue.pull_request.url }}" ]; then
echo "This is a pull request comment"
else
echo "This is not a pull request comment"
exit 1
fi

- name: Get PR Branch Name and Repo
if: steps.check-pr.outcome == 'success'
id: get-pr
uses: actions/github-script@v7
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const prBranch = pr.data.head.ref;
const repo = pr.data.head.repo.full_name;
return { pr_branch: prBranch, repo: repo };
result-encoding: string

- name: Use PR Branch Name and Repo
run: |
echo "The PR branch is ${{ steps.get-pr.outputs.pr_branch }}"
echo "The repository is ${{ steps.get-pr.outputs.repo }}"

cmd:
needs: [ set-image, get-pr-branch ]
env:
JOB_NAME: 'cmd'
runs-on: ${{ needs.set-image.outputs.RUNNER }}
Expand Down Expand Up @@ -291,7 +330,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
repository: ${{ needs.get-pr-branch.outputs.repo }}
ref: ${{ needs.get-pr-branch.outputs.pr-branch }}

- name: Install dependencies for bench
if: startsWith(steps.get-pr-comment.outputs.group2, 'bench')
Expand All @@ -317,11 +357,11 @@ jobs:
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"

git pull origin ${{ github.head_ref }}
git pull origin ${{ needs.get-pr-branch.outputs.pr-branch }}
git add .
git restore --staged Cargo.lock # ignore changes in Cargo.lock
git commit -m "Update from ${{ github.actor }} running command '${{ steps.get-pr-comment.outputs.group2 }}'" || true
git push origin ${{ github.head_ref }}
git push origin ${{ needs.get-pr-branch.outputs.pr-branch }}
else
echo "Nothing to commit";
fi
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/command-inform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Inform of new command action

on:
issue_comment:
types: [ created ]

jobs:
comment:
runs-on: ubuntu-latest
# Temporary disable the bot until the new command bot works properly
if: github.event.issue.pull_request && startsWith(github.event.comment.body, 'bot ') && false # disabled for now, until tested
steps:
- name: Inform that the new command exist
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'We have migrated the command bot to GHA<br/><br/>Please, see the new usage instructions <a href="https://github.com/paritytech/polkadot-sdk/blob/master/docs/contributor/commands-readme.md">here</a>. Soon the old commands will be disabled.'
})
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
41 changes: 41 additions & 0 deletions scripts/update-ui-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Script for updating the UI tests for a new rust stable version.
# Exit on error
set -e

# by default current rust stable will be used
RUSTUP_RUN=""
# check if we have a parameter
# ./scripts/update-ui-tests.sh 1.70
if [ ! -z "$1" ]; then
echo "RUST_VERSION: $1"
# This will run all UI tests with the rust stable 1.70.
# The script requires that rustup is installed.
RUST_VERSION=$1
RUSTUP_RUN="rustup run $RUST_VERSION"


echo "installing rustup $RUST_VERSION"
if ! command -v rustup &> /dev/null
then
echo "rustup needs to be installed"
exit
fi

rustup install $RUST_VERSION
rustup component add rust-src --toolchain $RUST_VERSION
fi

# Ensure we run the ui tests
export RUN_UI_TESTS=1
# We don't need any wasm files for ui tests
export SKIP_WASM_BUILD=1
# Let trybuild overwrite the .stderr files
export TRYBUILD=overwrite

# ./substrate
$RUSTUP_RUN cargo test --manifest-path substrate/primitives/runtime-interface/Cargo.toml ui
$RUSTUP_RUN cargo test -p sp-api-test ui
$RUSTUP_RUN cargo test -p frame-election-provider-solution-type ui
$RUSTUP_RUN cargo test -p frame-support-test --features=no-metadata-docs,try-runtime,experimental ui
$RUSTUP_RUN cargo test -p xcm-procedural ui
Loading