Skip to content

Commit

Permalink
Run flamegraph reporting in Github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dsocolobsky committed Dec 2, 2024
1 parent 52da6ca commit 4b9b05a
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/scripts/flamegraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

account=0x33c6b73432B3aeA0C1725E415CC40D04908B85fd
end_val=$((172 * 1000 * 10000000))

cd ../../

echo "Running ethrex..."
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --bin ethrex --features dev -- --network test_data/genesis-l2.json --http.port 1729 &
echo "Sleeping 10s before running test..."
sleep 10
echo "Sending to account $account"
ethrex_l2 test load --path ./test_data/private_keys.txt -i 1000 -v --value 10000000 --to $account

echo "Monitoring..."
output=$(cast balance $account --rpc-url=http://localhost:1729 2>&1)
echo "ini $output"
echo "end $end_val"
while [[ $output -le $end_val ]]; do
sleep 5
output=$(cast balance $account --rpc-url=http://localhost:1729 2>&1)
echo "out $output"
done
echo "Balance of $output reached, killing process ethrex"

sudo pkill ethrex && while pgrep -l cargo flamegraph; do sleep 1;done;
34 changes: 34 additions & 0 deletions .github/workflows/flamegraph_reporter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Daily Flamegraph Reporter

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "**" ]
workflow_dispatch:

env:
RUST_VERSION: 1.81.0

jobs:
flamegraph:
name: Generate Flamegraph for load test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}

- name: Install flamegraph
run: cargo install flamegraph

- name: Caching
uses: Swatinem/rust-cache@v2

- name: Generate Flamegraph for Ethrex
run: |
sh .github/scripts/flamegraph.sh

0 comments on commit 4b9b05a

Please sign in to comment.