From 9f2451294d98a7d1a76d494af99cbab1ee772371 Mon Sep 17 00:00:00 2001 From: Thomas Chataigner Date: Fri, 25 Oct 2024 15:36:44 +0200 Subject: [PATCH] test: test workflow and bench changes --- .github/workflows/bench.yml | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index b8b815e5..aa97de45 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -299,3 +299,84 @@ jobs: # Ignored if `type: private` topic: "${{ env.TOPIC }}" content: "${{ steps.run-benchmarks.outputs.report }}" + + bench-test: + name: Light client benchmark test + runs-on: warp-custom-r7iz-metal-16xl + steps: + - uses: actions/checkout@v4 + with: + repository: argumentcomputer/ci-workflows + - uses: ./.github/actions/ci-env + - uses: actions/checkout@v4 + - name: Setup CI + uses: ./.github/actions/setup + - name: Install extra deps + run: | + sudo apt-get update && sudo apt-get install -y python3-pip + pip3 --version + pip3 install --break-system-packages jtbl + echo 'PATH="$HOME/.local/bin:$PATH"' >> ~/.profile + source ~/.profile + which jtbl + - name: Set env + run: | + # Default benchmark settings optimized for light clients, can be overwritten with `env` input + echo "RUSTFLAGS=-C target-cpu=native --cfg tokio_unstable -C opt-level=3" | tee -a $GITHUB_ENV + echo "SHARD_SIZE=4194304" | tee -a $GITHUB_ENV + echo "SHARD_BATCH_SIZE=0" | tee -a $GITHUB_ENV + echo "RECONSTRUCT_COMMITMENTS=false" | tee -a $GITHUB_ENV + echo "SHARD_CHUNKING_MULTIPLIER=1" | tee -a $GITHUB_ENV + echo "MODE=SNARK" | tee -a $GITHUB_ENV + + IFS=',' read -ra ENV_VARS <<< "ethereum" + for VAR in "${ENV_VARS[@]}"; do + VAR_NAME="${VAR%%=*}" + VAR_VALUE="${VAR#*=}" + echo "${VAR_NAME}=${VAR_VALUE}" | tee -a $GITHUB_ENV + done + - name: Parse Zulip inputs + run: | + echo "TYPE=private" | tee -a $GITHUB_ENV + echo "STREAM=114" | tee -a $GITHUB_ENV + - name: Run benchmarks + id: run-benchmarks + run: | + make bench-ci BENCH=spv 2>&1 | tee out.txt + + grep 'cycles=' out.txt > cycles.txt + grep 'proving_time' out.txt > timings.txt + + while IFS=$'\t' read -r f1 f2 + do + num_cycles=$(echo "$f1" | grep -o 'cycles=[0-9]*' | awk -F'=' '{ print $2 }') + echo "$f2" | jq -c --argjson cycles "$num_cycles" '. += {cycles: $cycles}' >> summary.json + done < <(paste cycles.txt timings.txt) + + echo "# Kadena Benchmark Results " | tee -a summary.md + echo "## SPV Prove" | tee -a summary.md + cat summary.json | jtbl -m | tee -a summary.md + echo "" | tee -a summary.md + + echo "Time unit = milliseconds" | tee -a summary.md + echo "Workflow URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | tee -a summary.md + + echo "report<> $GITHUB_OUTPUT + cat summary.md >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + working-directory: ${{ github.workspace }}/kadena/light-client + #- name: Write bench on commit comment + # uses: peter-evans/commit-comment@v3 + # with: + # body-path: ${{ github.workspace }}/${{ inputs.light-client }}/light-client/summary.md + - name: Send report to Zulip + uses: zulip/github-actions-zulip/send-message@v1 + with: + api-key: ${{ secrets.ZULIP_API_KEY }} + email: "aineko-bot@zulip.lurk-lab.com" + organization-url: "https://zulip.argument.xyz" + to: "${{ env.STREAM }}" + type: "${{ env.TYPE }}" + # Ignored if `type: private` + topic: "${{ env.TOPIC }}" + content: "${{ steps.run-benchmarks.outputs.report }}" \ No newline at end of file