From 6498d416db8389aabe6ff23b0535bfff81df0a6c Mon Sep 17 00:00:00 2001 From: Dylan Socolobsky Date: Thu, 5 Dec 2024 15:32:40 -0300 Subject: [PATCH] Use Github Action Outputs for test times --- .github/scripts/flamegraph.sh | 3 +-- .github/scripts/flamegraph_reth.sh | 3 +-- .github/workflows/flamegraph_reporter.yaml | 30 ++++++++-------------- pages/index.html | 4 +-- 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/.github/scripts/flamegraph.sh b/.github/scripts/flamegraph.sh index ef384d69d0..9f2ebbc301 100644 --- a/.github/scripts/flamegraph.sh +++ b/.github/scripts/flamegraph.sh @@ -25,5 +25,4 @@ echo "Balance of $output reached in $minutes min $seconds s, killing process eth sudo pkill ethrex && while pgrep -l "cargo-flamegraph"; do echo "waiting for reth to exit... "; sleep 1;done; # We need this for the following job, to add to the static page -# Using Github Outputs would be easier, but I couldn't get it to work -echo -e "$minutes minutes $seconds seconds" >> /home/runner/work/ethrex/ethrex/times.txt +echo "time=$minutes minutes $seconds seconds" >> "$GITHUB_OUTPUT" diff --git a/.github/scripts/flamegraph_reth.sh b/.github/scripts/flamegraph_reth.sh index 38d6609c54..b138eae7ba 100644 --- a/.github/scripts/flamegraph_reth.sh +++ b/.github/scripts/flamegraph_reth.sh @@ -25,5 +25,4 @@ echo "Balance of $output reached in $minutes min $seconds s, killing process ret sudo pkill reth && while pgrep -l "cargo-flamegraph"; do echo "waiting for reth to exit... "; sleep 1;done; # We need this for the following job, to add to the static page -# Using Github Outputs would be easier, but I couldn't get it to work -echo -e "$minutes minutes $seconds seconds" >> /home/runner/work/ethrex/ethrex/times.txt +echo "time=$minutes minutes $seconds seconds" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/flamegraph_reporter.yaml b/.github/workflows/flamegraph_reporter.yaml index 4e0605de68..011bd74642 100644 --- a/.github/workflows/flamegraph_reporter.yaml +++ b/.github/workflows/flamegraph_reporter.yaml @@ -20,6 +20,8 @@ jobs: flamegraph: name: Generate Flamegraph for load test runs-on: ubuntu-latest + outputs: + time: ${{steps.generate-flamegraph-ethrex.outputs.time}} steps: - name: Checkout sources uses: actions/checkout@v4 @@ -54,11 +56,12 @@ jobs: - name: Build ethrex run: CARGO_PROFILE_RELEASE_DEBUG=true cargo build --release --bin ethrex --features dev - - id: generate-flamegraph + - id: generate-flamegraph-ethrex name: Generate Flamegraph data for Ethrex shell: bash run: | - CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" --bin ethrex --features dev -- --network test_data/genesis-l2.json --http.port 1729 & + CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" \ + --bin ethrex --features dev -- --network /home/runner/work/ethrex/ethrex/test_data/genesis-l2.json --http.port 1729 & echo "waiting to execute load test..." sleep 30 && echo "executing load test..." @@ -83,6 +86,8 @@ jobs: flamegraph-reth: name: Generate Flamegraph for Reth runs-on: ubuntu-latest + outputs: + time: ${{steps.generate-flamegraph-reth.outputs.time}} steps: - name: Checkout sources uses: actions/checkout@v4 @@ -121,7 +126,8 @@ jobs: repository: paradigmxyz/reth path: 'reth' - - name: Build and test reth + - id: generate-flamegraph-reth + name: Build and test reth shell: bash run: | cd ./reth @@ -177,18 +183,6 @@ jobs: name: flamegraph_reth.svg path: flamegraph_reth.svg - - name: Download time reports for ethrex - uses: actions/download-artifact@v4 - with: - name: times_ethrex - path: times_ethrex.txt - - - name: Download time reports for reth - uses: actions/download-artifact@v4 - with: - name: times_reth - path: times_reth.txt - - name: Update static page locally with new data shell: bash run: | @@ -198,11 +192,9 @@ jobs: cp -r flamegraph_reth.svg pages/ ls -las pages/ date +'%Y-%m-%dT%H:%M:%S' - ethrex_time=$(cat times_ethrex.txt) - reth_time=$(cat times_reth.txt) sed -i "s/{{LAST_UPDATE}}/$(date +'%Y-%m-%dT%H:%M:%S')/g" pages/index.html - sed -i "s/{{ETHREX_TIME}}/$ethrex_time/g" pages/index.html - sed -i "s/{{RETH_TIME}}/$reth_time/g" pages/index.html + sed -i "s/{{ETHREX_TIME}}/${{ needs.flamegraph-ethrex.outputs.time }}/g" pages/index.html + sed -i "s/{{RETH_TIME}}/${{ needs.flamegraph-reth.outputs.time }}/g" pages/index.html - name: Setup Pages uses: actions/configure-pages@v5 diff --git a/pages/index.html b/pages/index.html index a2ed1046bf..846387eff6 100644 --- a/pages/index.html +++ b/pages/index.html @@ -18,7 +18,7 @@

Ethrex

Download -

Time elapsed: {{ETHREX_MIN}}min {{ETHREX_SEC}}s

+

Time elapsed: {{ETHREX_TIME}}

@@ -27,7 +27,7 @@

Ethrex

Reth

Download -

Time elapsed: {{RETH_MIN}}min {{RETH_SEC}}s

+

Time elapsed: {{RETH_TIME}}