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

Add try-runtime to ci pipeline #1735

Merged
merged 15 commits into from
Mar 20, 2024
Merged
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
97 changes: 97 additions & 0 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: try-runtime
on:
schedule:
- cron: '0 6 * * 0' # At 00:00 on Sunday
issue_comment:
types: [created]
pull_request:
types: [labeled]
paths:
- '**.rs'
- .github/workflows/try-runtime.yml
jobs:
try-runtime:
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
chain: [altair, centrifuge]
if: >
github.event_name == 'schedule' ||
contains(github.event.pull_request.labels.*.name, 'D8-migration') ||
(github.event_name == 'issue_comment' &&
contains(github.event.comment.body, '/try-runtime') &&
github.event.issue.pull_request != '')

runs-on: ubuntu-latest-4-cores
name: "${{ matrix.chain }}"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2

- name: Get PR author and commenter
id: get-users
if: github.event_name == 'issue_comment'
run: |
PR_AUTHOR=$(gh pr view ${{ github.event.issue.number }} --json author --jq .author.login)
COMMENT_AUTHOR="${{ github.event.comment.user.login }}"
echo "::set-output name=pr_author::$PR_AUTHOR"
echo "::set-output name=comment_author::$COMMENT_AUTHOR"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check if commenter is PR author and a repo contributor
if: >
steps.get-users.outputs.pr_author == steps.get-users.outputs.comment_author &&
github.event_name == 'issue_comment'
run: |
if [[ "${{ steps.get-users.outputs.pr_author }}" != "${{ steps.get-users.outputs.comment_author }}" ]]; then
echo "PR author is not the comment author."
exit 1
fi
CONTRIBUTOR_CHECK=$(gh api repos/${{ github.repository }}/contributors --jq '.[].login | select(. == "${{ steps.get-users.outputs.comment_author }}")')
if [[ -z "$CONTRIBUTOR_CHECK" ]]; then
echo "Commenter is not a contributor."
exit 1
fi
echo "Commenter is a contributor and PR author."

- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
cache: enabled
GWIP: ${{ secrets.GWIP_SCCACHE }}
GSA: ${{ secrets.GSA_SCCACHE }}

# - name: Install try-runtime-cli
# run: cargo install --git https://github.com/paritytech/try-runtime-cli --tag v0.5.4 --locked
- name: cargo build
run: ./ci/run-check.sh -F try-runtime
env:
TARGET: cargo-build
RUSTC_WRAPPER: "sccache"

- name: Run try-runtime
run: ./ci/run-check.sh "${{ matrix.chain }}"
env:
TARGET: try-runtime

notify-slack:
needs: try-runtime
if: always() && needs.try-runtime.result == 'failure' && github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- name: Notify Slack
uses: rtCamp/action-slack-notify@b24d75fe0e728a4bf9fc42ee217caa686d141ee8 #v2.2.1
env:
SLACK_CHANNEL: eng-protocol-general
SLACK_COLOR: '#FF0000'
SLACK_ICON: "https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png"
SLACK_MESSAGE: |
Weekly try-runtime job failed on main branch. Please check:
<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|GHA Job URL>
SLACK_TITLE: 'Job Failure Notification'
SLACK_USERNAME: "Centrifuge GHA Bot"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
21 changes: 20 additions & 1 deletion ci/run-check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,26 @@ case $TARGET in
docs-build)
RUSTDOCFLAGS="-D warnings" cargo doc --all --no-deps
;;


try-runtime)
if [ "$1" == "altair" ]; then
echo "Running try-runtime for altair"
RUST_LOG=runtime=trace,try-runtime::cli=trace,executor=trace \
cargo run --release --features try-runtime try-runtime \
--runtime target/release/wbuild/altair-runtime/altair_runtime.wasm \
--chain altair on-runtime-upgrade live \
--uri wss://fullnode.altair.centrifuge.io:443
elif [ "$1" == "centrifuge" ]; then
echo "Running try-runtime for centrifuge"
RUST_LOG=runtime=trace,try-runtime::cli=trace,executor=trace \
cargo run --release --features try-runtime try-runtime \
--runtime target/release/wbuild/centrifuge-runtime/centrifuge_runtime.wasm \
--chain centrifuge on-runtime-upgrade live --uri wss://fullnode.centrifuge.io:443
else
echo "Invalid argument. Please specify 'altair' or 'centrifuge'."
exit 1
fi
;;
subalfred)
# Find all child directories containing Cargo.toml files
# TODO: Filter by crates found in the workspace
Expand Down
Loading