✨ New CT Migration benchmarks #527
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Set-Up & Build | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
inputs: | |
CRATE: | |
description: "Which crate do you want to test?" | |
required: false | |
default: "pallet-funding" | |
type: string | |
issue_comment: | |
types: [created] | |
env: | |
RUSTFLAGS: "" # To ovveride the default "-D warnings" that can be too tedious. | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
fmt: | |
if: (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/bot fmt')) || github.event_name == 'workflow_dispatch' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
container: | |
image: paritytech/ci-linux:production | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set commit status as pending | |
uses: myrotvorets/set-commit-status-action@v2.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: pending | |
context: Checking formatting | |
- name: Install Rust | |
# Force Rust Nightly to check the formatting | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: false | |
- name: Check the formatting | |
run: cargo +nightly fmt --all --check | |
- name: Add comment to PR | |
uses: actions/github-script@v6 | |
if: always() | |
with: | |
script: | | |
const name = '${{ github.job }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ job.status }}' === 'success'; | |
const body = `${name}: ${success ? 'Succeeded! ✅' : 'Failed ❌'}\n${url}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
- name: Set final commit status | |
uses: myrotvorets/set-commit-status-action@v2.0.0 | |
if: always() | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
context: Checking formatting | |
test: | |
if: (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/bot test')) || github.event_name == 'workflow_dispatch' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
container: | |
image: paritytech/ci-linux:production | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set commit status as pending | |
uses: myrotvorets/set-commit-status-action@v2.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: pending | |
context: Running tests | |
- name: Sets env vars for NOT integration-tests (if from workflow_dispatch) | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: github.event_name == 'workflow_dispatch' && !contains(github.event.inputs.CRATE, 'integration-tests') | |
- name: Set Body var | |
run: echo "BODY=${{ github.event.comment.body }}" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' | |
- name: Extract from BODY | |
run: | | |
extracted_value="${BODY#*test }" | |
echo "EXTRACTED_VALUE=$extracted_value" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' | |
- name: Determine Crate Name | |
id: crate_name | |
run: echo "CRATE_NAME=${{ env.EXTRACTED_VALUE }}" >> $GITHUB_OUTPUT | |
if: github.event_name == 'issue_comment' | |
- name: Sets env vars for NOT integration-tests (if from issue_comment) | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' && !contains(steps.crate_name.outputs.CRATE_NAME, 'integration-tests') | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: false | |
if: ${{ env.ACT }} | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: true | |
if: ${{ !env.ACT }} | |
- name: Test the Parachain (if from issue_comment) | |
run: cargo test -p '${{ steps.crate_name.outputs.CRATE_NAME }}' --locked | |
if: github.event_name == 'issue_comment' | |
- name: Test the Parachain (if from workflow_dispatch) | |
run: cargo test -p '${{ github.event.inputs.CRATE }}' --locked | |
if: github.event_name == 'workflow_dispatch' | |
- name: Add comment to PR | |
uses: actions/github-script@v6 | |
if: always() | |
with: | |
script: | | |
const name = '${{ github.job }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ job.status }}' === 'success'; | |
const body = `${name}: ${success ? 'Succeeded! ✅' : 'Failed ❌'}\n${url}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
- name: Set final commit status | |
uses: myrotvorets/set-commit-status-action@v2.0.0 | |
if: always() | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
context: Running tests | |
benchmark: | |
if: (github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/bot benchmark')) || github.event_name == 'workflow_dispatch' | |
# The type of runner that the job will run on | |
runs-on: ubuntu-22.04 | |
container: | |
image: paritytech/ci-linux:production | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
- name: Set commit status as pending | |
uses: myrotvorets/set-commit-status-action@v2.0.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: pending | |
context: Running benchmarks tests | |
- name: Sets env vars for NOT integration-tests (if from workflow_dispatch) | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: github.event_name == 'workflow_dispatch' && !contains(github.event.inputs.CRATE, 'integration-tests') | |
- name: Set Body var | |
run: echo "BODY=${{ github.event.comment.body }}" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' | |
- name: Extract from BODY | |
run: | | |
extracted_value="${BODY#*benchmark }" | |
echo "EXTRACTED_VALUE=$extracted_value" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' | |
- name: Determine Crate Name | |
id: crate_name | |
run: echo "CRATE_NAME=${{ env.EXTRACTED_VALUE }}" >> $GITHUB_OUTPUT | |
if: github.event_name == 'issue_comment' | |
- name: Sets env vars for NOT integration-tests (if from issue_comment) | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: github.event_name == 'issue_comment' && !contains(steps.crate_name.outputs.CRATE_NAME, 'integration-tests') | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: false | |
if: ${{ env.ACT }} | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: true | |
if: ${{ !env.ACT }} | |
- name: Test the Benchmarks (if from issue_comment) | |
run: cargo test --features=runtime-benchmarks -p '${{ steps.crate_name.outputs.CRATE_NAME }}' --locked benchmark_tests | |
if: github.event_name == 'issue_comment' | |
- name: Test the Benchmarks (if from workflow_dispatch) | |
run: cargo test --features=runtime-benchmarks -p '${{ github.event.inputs.CRATE }}' --locked benchmark_tests | |
if: github.event_name == 'workflow_dispatch' | |
- name: Add comment to PR | |
uses: actions/github-script@v6 | |
if: always() | |
with: | |
script: | | |
const name = '${{ github.job }}'; | |
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'; | |
const success = '${{ job.status }}' === 'success'; | |
const body = `${name}: ${success ? 'Succeeded! ✅' : 'Failed ❌'}\n${url}`; | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: body | |
}) | |
- name: Set final commit status | |
uses: myrotvorets/set-commit-status-action@master | |
if: always() | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
context: Running benchmarks tests |