From 4dcdead6b6aa12c103291d094b8375b7d0d80dd4 Mon Sep 17 00:00:00 2001 From: Vinh Date: Thu, 3 Aug 2023 15:24:04 -0700 Subject: [PATCH 1/3] accept list of pallet for benchmark action 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. --- .github/workflows/benchmark.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index cce281ffd..922d8694f 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -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: @@ -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 From 66735b47307cc01cf27b7583d3179d96c7558b5b Mon Sep 17 00:00:00 2001 From: Vinh Date: Thu, 3 Aug 2023 18:07:43 -0700 Subject: [PATCH 2/3] use new syntax --- .github/workflows/benchmark.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 922d8694f..00a101458 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -23,7 +23,8 @@ jobs: # 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)" + echo "{pallet}={$(echo -n ${{ inputs.pallet }} | jq --raw-input --slurp 'split(",")' -c)}" >> $GITHUB_OUTPUT + cat $GITHUB_OUTPUT build-binary: runs-on: self-hosted From b3049d3de68a11121d6b03f6ae3b9ec042cfbbfe Mon Sep 17 00:00:00 2001 From: Vinh Date: Thu, 3 Aug 2023 21:37:02 -0700 Subject: [PATCH 3/3] correct syntax --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 00a101458..3714e7694 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -23,7 +23,7 @@ jobs: # 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 "{pallet}={$(echo -n ${{ inputs.pallet }} | jq --raw-input --slurp 'split(",")' -c)}" >> $GITHUB_OUTPUT + echo "pallet=$(echo -n ${{ inputs.pallet }} | jq --raw-input --slurp 'split(",")' -c)" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT build-binary: