Skip to content

Commit

Permalink
[skip ci] frameomnibencher short
Browse files Browse the repository at this point in the history
  • Loading branch information
mordamax committed Aug 6, 2024
1 parent 035211d commit 856f078
Show file tree
Hide file tree
Showing 6 changed files with 189 additions and 67 deletions.
57 changes: 0 additions & 57 deletions .github/workflows/check-changed-files.yml

This file was deleted.

122 changes: 122 additions & 0 deletions .github/workflows/check-frame-omni-bencher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
name: Short benchmarks

on:
push:
branches:
- mak-frame-omnibench-checks # TODO: master
pull_request:
# TODO: types: [ opened, synchronize, reopened, ready_for_review ]
workflow_dispatch: # TODO: remove
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: "-C debug-assertions -D warnings"
RUST_BACKTRACE: "full"
WASM_BUILD_NO_COLOR: 1
WASM_BUILD_RUSTFLAGS: "-C debug-assertions -D warnings"
ARTIFACTS_NAME: frame-omni-bencher-artifacts

jobs:
changes:
if: startsWith(github.event.comment.body, '/recheck') || github.event_name == 'workflow_dispatch'
permissions:
pull-requests: read
uses: ./.github/workflows/reusable-check-changed-files.yml
set-image:
# GitHub Actions allows using 'env' in a container context.
# However, env variables don't work for forks: https://github.com/orgs/community/discussions/44322
# This workaround sets the container image for each job using 'set-image' job output.
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.rust }}
outputs:
IMAGE: ${{ steps.set_image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- id: set_image
run: cat .github/env >> $GITHUB_OUTPUT

build-frame-omni-bencher:
runs-on: arc-runners-beefy-stg # TODO: arc-runners-polkadot-sdk-beefy
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
timeout-minutes: 30
container:
image: ${{ needs.set-image.outputs.IMAGE }}
env:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: |
forklift cargo build --release --locked -p frame-omni-bencher --workspace
# archive the target directory
tar -czf $ARCHIVE_NAME target
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACTS_NAME }}
retention-days: 1
compression-level: 9
path: ./target

run-frame-omni-bencher:
runs-on: arc-runners-beefy-stg # TODO:arc-runners-polkadot-sdk-beefy
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
timeout-minutes: 30
strategy:
matrix:
runtime:
[
westend-runtime,
rococo-runtime,
asset-hub-rococo-runtime,
asset-hub-westend-runtime,
bridge-hub-rococo-runtime,
bridge-hub-westend-runtime,
collectives-westend-runtime,
coretime-rococo-runtime,
coretime-westend-runtime,
people-rococo-runtime,
people-westend-runtime,
glutton-westend-runtime,
]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
env:
# Enable debug assertions since we are running optimized builds for testing
# but still want to have debug assertions.
RUSTFLAGS: "-Cdebug-assertions=y -Dwarnings"
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ./target

- name: script
run: |
RUNTIME_BLOB_NAME=$(echo $PACKAGE_NAME | sed 's/-/_/g').compact.compressed.wasm
RUNTIME_BLOB_PATH=./target/release/wbuild/$PACKAGE_NAME/$RUNTIME_BLOB_NAME
echo "Running short benchmarking for PACKAGE_NAME=$PACKAGE_NAME and RUNTIME_BLOB_PATH=$RUNTIME_BLOB_PATH"
ls -lrt $RUNTIME_BLOB_PATH
./target/release/frame-omni-bencher v1 benchmark pallet --runtime $RUNTIME_BLOB_PATH --all --steps 2 --repeat 1
confirm-frame-omni-benchers-passed:
runs-on: ubuntu-latest
name: All migrations passed
needs: run-frame-omni-bencher
steps:
- run: echo '### Good job! All the benchmarks passed 🚀' >> $GITHUB_STEP_SUMMARY
57 changes: 57 additions & 0 deletions .github/workflows/reusable-check-changed-files.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Reusable workflow to perform checks and generate conditions for other workflows.
# Currently it checks if any Rust (build-related) file is changed
# and if the current (caller) workflow file is changed.
# Example:
#
# jobs:
# changes:
# permissions:
# pull-requests: read
# uses: ./.github/workflows/reusable-check-changed-files.yml
# some-job:
# needs: changes
# if: ${{ needs.changes.outputs.rust }}
# .......

name: Check changes files

on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
rust:
value: ${{ jobs.changes.outputs.rust }}
description: "true if any of the build-related OR current (caller) workflow files have changed"
current-workflow:
value: ${{ jobs.changes.outputs.current-workflow }}
description: "true if current (caller) workflow file has changed"

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
# true if current workflow (caller) file is changed
rust: ${{ steps.filter.outputs.rust == 'true' || steps.filter.outputs.current-workflow == 'true' }}
current-workflow: ${{ steps.filter.outputs.current-workflow }}
steps:
- id: current-file
run: echo "current-workflow-file=$(echo ${{ github.workflow_ref }} | sed -nE "s/.*(\.github\/workflows\/[a-zA-Z0-9_-]*\.y[a]?ml)@refs.*/\1/p")" >> $GITHUB_OUTPUT
- run: echo "${{ steps.current-file.outputs.current-workflow-file }}"
# For pull requests it's not necessary to checkout the code
- id: filter
uses: dorny/paths-filter@v3
with:
predicate-quantifier: "every"
# current-workflow - check if the current (caller) workflow file is changed
# rust - check if any Rust (build-related) file is changed
filters: |
current-workflow:
- '${{ steps.current-file.outputs.current-workflow-file }}'
rust:
- '**/*'
- '!.github/**/*'
- '!prdoc/**/*'
- '!docs/**/*'
#
8 changes: 4 additions & 4 deletions .github/workflows/tests-linux-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [ opened, synchronize, reopened, ready_for_review ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -16,7 +16,7 @@ jobs:
changes:
permissions:
pull-requests: read
uses: ./.github/workflows/check-changed-files.yml
uses: ./.github/workflows/reusable-check-changed-files.yml

set-image:
# GitHub Actions allows using 'env' in a container context.
Expand All @@ -34,7 +34,7 @@ jobs:
run: cat .github/env >> $GITHUB_OUTPUT

test-linux-stable-int:
needs: [set-image, changes]
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 60
Expand All @@ -55,7 +55,7 @@ jobs:

# https://github.com/paritytech/ci_cd/issues/864
test-linux-stable-runtime-benchmarks:
needs: [set-image, changes]
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 60
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
types: [ opened, synchronize, reopened, ready_for_review ]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand All @@ -15,7 +15,7 @@ jobs:
changes:
permissions:
pull-requests: read
uses: ./.github/workflows/check-changed-files.yml
uses: ./.github/workflows/reusable-check-changed-files.yml

set-image:
# GitHub Actions allows using 'env' in a container context.
Expand All @@ -31,7 +31,7 @@ jobs:
run: cat .github/env >> $GITHUB_OUTPUT

quick-benchmarks:
needs: [set-image, changes]
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 60
Expand All @@ -50,7 +50,7 @@ jobs:

# cf https://github.com/paritytech/polkadot-sdk/issues/1652
test-syscalls:
needs: [set-image, changes]
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 60
Expand All @@ -75,7 +75,7 @@ jobs:
# fi

cargo-check-all-benches:
needs: [set-image, changes]
needs: [ set-image, changes ]
if: ${{ needs.changes.outputs.rust }}
runs-on: arc-runners-polkadot-sdk-beefy
timeout-minutes: 60
Expand Down
2 changes: 1 addition & 1 deletion .gitlab/pipeline/short-benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# run short-benchmarks for relay chain runtimes from polkadot

short-benchmark-westend: &short-bench
short-benchmark-westend:
stage: short-benchmarks
extends:
- .docker-env
Expand Down

0 comments on commit 856f078

Please sign in to comment.