Skip to content

Commit

Permalink
accept list of pallet for benchmark action
Browse files Browse the repository at this point in the history
when benchmark is being removed between different branch/tag the
benchmark may failed to run without updating the hard code list of
pallet in github action.

We now accept list of pallet to benchmark from the action input.
  • Loading branch information
v9n committed Aug 3, 2023
1 parent 8658161 commit 4dcdead
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,29 @@ name: Benchmark

on:
workflow_dispatch:
inputs:
pallet:
description: provided a list of pallet to run benchmark on
default: 'automation_time,vesting,valve,xcmp_handler'
required: true

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
gen-params:
runs-on: ubuntu-latest
outputs:
pallet: ${{ steps.set-matrix.outputs.pallet }}
steps:
- id: set-matrix
run: |
# Matrix only take a list so we use fromJSON to convert raw json string data to list
# The input is from Github action input, which doesn't support list so we take raw string separate by ','
# Convert the string a,b,c -> a json array ["a", "b", "c"] with bracket and double quote properly
echo "::set-output name=pallet::$(echo -n ${{ inputs.tag }} | jq --raw-input --slurp 'split(",")' -c)"
build-binary:
runs-on: self-hosted
steps:
Expand All @@ -28,17 +45,15 @@ jobs:
name: oak-collator
path: artifacts/
retention-days: 1

run-benchmarks:
name: Run Benchmarks
runs-on: self-hosted
needs: build-binary
needs: [gen-params, build-binary]
strategy:
matrix:
pallet:
- automation_time
- vesting
- valve
- xcmp_handler
pallet: ${{ fromJSON(needs.gen-params.outputs.pallet) }}

steps:
- name: Download binary
uses: actions/download-artifact@v2
Expand Down

0 comments on commit 4dcdead

Please sign in to comment.