Feature/plmc 264 write pallet linear benchmarks #238
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: Install Rust | |
# Force Rust Nightly to check the formatting | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
cache: true | |
- 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.workflow }}'; | |
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 | |
}) | |
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: Sets env vars for NOT integration-tests | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: ${{ !contains(github.event.inputs.CRATE, 'integration-tests') }} | |
- name: Determine Crate Name | |
id: crate_name | |
run: | | |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then | |
echo "::set-output name=value::$(echo ${{github.event.comment.body}} | cut -d' ' -f3)" | |
else | |
echo "::set-output name=value::${{ github.event.inputs.CRATE }}" | |
fi | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: true | |
- name: Test the Parachain | |
run: cargo test -p "${{ steps.crate_name.outputs.value }}" --locked | |
- 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 | |
}) | |
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: Sets env vars for NOT integration-tests | |
run: | | |
echo "SKIP_WASM_BUILD=1" >> "$GITHUB_ENV" | |
if: ${{ !contains(github.event.inputs.CRATE, 'integration-tests') }} | |
- name: Determine Crate Name | |
id: crate_name | |
run: | | |
if [[ "${{ github.event_name }}" == "issue_comment" ]]; then | |
echo "::set-output name=value::$(echo ${{github.event.comment.body}} | cut -d' ' -f3)" | |
else | |
echo "::set-output name=value::${{ github.event.inputs.CRATE }}" | |
fi | |
- name: Sets env vars for NOT integration-tests | |
run: | | |
echo "cargo test --features=runtime-benchmarks -p '${{ github.event.inputs.CRATE }}' --locked" | |
- name: Install Rust | |
# Using the version specified in the rust-toolchain.toml | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
cache: true | |
- name: Test the Benchmarks | |
run: cargo test --features=runtime-benchmarks -p "${{ steps.crate_name.outputs.value }}" --locked | |
- 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 | |
}) |