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

[WIP][ci] Move short benchmarks to GHA #4617

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
908aaa5
[WIP][ci] Move short benchmarks to GHA
alvicsam May 28, 2024
bb0134c
rename gha
alvicsam May 28, 2024
0486037
check artifact location
alvicsam May 28, 2024
b6b98a4
make binary executable
alvicsam May 28, 2024
0c22cdf
add short bench parachain
alvicsam May 28, 2024
db2a86f
fix indent
alvicsam May 28, 2024
9dfa4a4
rm mv command
alvicsam May 28, 2024
ae29fe7
fix build parachain bench
alvicsam May 28, 2024
5cdb975
add retention
alvicsam May 29, 2024
4ab4b96
comment short benches in gitlab
alvicsam May 29, 2024
d2ca673
fix short-bench.yml
alvicsam May 29, 2024
191044b
comment cancel
alvicsam May 29, 2024
1d9491a
Merge branch 'master' into as-gha-bench
alvicsam May 29, 2024
2c25d4a
add Check changes files
alvicsam May 29, 2024
cb6c028
restart pipeline
alvicsam May 29, 2024
0deaa00
add additional need to test caching
alvicsam May 29, 2024
9c7ce8c
Merge branch 'master' into as-gha-bench
alvicsam Jun 21, 2024
ccbcc10
rm old forklift credentials
alvicsam Jun 21, 2024
bf8ae91
Merge branch 'master' into as-gha-bench
alvicsam Jul 15, 2024
4f496a6
Merge branch 'master' into as-gha-bench
alvicsam Jul 17, 2024
7f7f380
Merge branch 'master' into as-gha-bench
alvicsam Jul 17, 2024
f302566
Merge branch 'master' into as-gha-bench
alvicsam Jul 18, 2024
eac07b6
Merge branch 'master' into as-gha-bench
alvicsam Jul 18, 2024
61175eb
Empty commit to trigger ci
alvicsam Jul 18, 2024
7b5a0b0
add confirm-short-benchmarks-passed job
alvicsam Jul 18, 2024
52e740c
rearrange build
alvicsam Jul 19, 2024
c314c22
enable benchmarks in gitlab back
alvicsam Jul 22, 2024
aa41267
some more uncomment
alvicsam Jul 22, 2024
85b612e
Merge branch 'master' into as-gha-bench
alvicsam Jul 24, 2024
b4d5d9e
Merge branch 'master' into as-gha-bench
alvicsam Jul 25, 2024
cf325ac
return cancel
alvicsam Aug 2, 2024
98d84ba
Merge branch 'master' into as-gha-bench
mordamax Aug 5, 2024
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
134 changes: 134 additions & 0 deletions .github/workflows/build-run-short-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Short benchmarks

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
changes:
permissions:
pull-requests: read
uses: ./.github/workflows/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-short-benchmark:
runs-on: arc-runners-polkadot-sdk-beefy
needs: [set-image, changes]
if: ${{ needs.changes.outputs.rust }}
timeout-minutes: 30
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: script
run: |
forklift cargo build --profile release --locked --features=runtime-benchmarks,on-chain-release-build --bin polkadot --workspace
mkdir -p artifacts
target/release/polkadot --version
cp ./target/release/polkadot ./artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: short-benchmark-artifacts
retention-days: 1
path: ./artifacts
build-short-benchmark-cumulus:
runs-on: 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: script
run: |
forklift cargo build --profile release --locked --features=runtime-benchmarks,on-chain-release-build -p polkadot-parachain-bin --bin polkadot-parachain --workspace
mkdir -p artifacts
./target/release/polkadot-parachain --version
cp ./target/release/polkadot-parachain ./artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: short-benchmark-cumulus-artifacts
retention-days: 1
path: ./artifacts
short-benchmark-westend:
runs-on: arc-runners-polkadot-sdk-benchmark
timeout-minutes: 10
needs: [set-image, build-short-benchmark]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
env:
RUNTIME: westend
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: short-benchmark-artifacts
- name: script
run: |
chmod +x polkadot
./polkadot benchmark pallet --chain $RUNTIME-dev --pallet "*" --extrinsic "*" --steps 2 --repeat 1
short-benchmark-parachain:
runs-on: arc-runners-polkadot-sdk-benchmark
timeout-minutes: 10
strategy:
matrix:
runtime:
[
asset-hub-rococo-dev,
asset-hub-westend-dev,
bridge-hub-rococo-dev,
bridge-hub-westend-dev,
collectives-westend-dev,
coretime-rococo-dev,
coretime-westend-dev,
people-rococo-dev,
people-westend-dev,
glutton-westend-dev-1300,
]
needs: [set-image, build-short-benchmark-cumulus]
container:
image: ${{ needs.set-image.outputs.IMAGE }}
steps:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: short-benchmark-cumulus-artifacts
- name: script
run: |
chmod +x polkadot-parachain
./polkadot-parachain benchmark pallet --chain ${{ matrix.runtime }} --pallet "*" --extrinsic "*" --steps 2 --repeat 1
confirm-short-benchmarks-passed:
runs-on: ubuntu-latest
name: All migrations passed
# If any new job gets added, be sure to add it to this array
needs: [short-benchmark-parachain, short-benchmark-westend]
steps:
- run: echo '### Good job! All the benchmarks passed 🚀' >> $GITHUB_STEP_SUMMARY
50 changes: 25 additions & 25 deletions .github/workflows/check-changed-files.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Reusable workflow to perform checks and generate conditions for other workflows.
# 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:
Expand All @@ -11,20 +11,20 @@
# 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:
rust:
value: ${{ jobs.changes.outputs.rust }}
description: 'true if any of the build-related OR current (caller) workflow files have changed'
current-workflow:
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'
description: "true if current (caller) workflow file has changed"

jobs:
changes:
Expand All @@ -36,22 +36,22 @@ jobs:
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/**/*'
#
- 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/**/*'
#
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
Loading