Skip to content

Commit

Permalink
Use Github Action Outputs for test times
Browse files Browse the repository at this point in the history
  • Loading branch information
dsocolobsky committed Dec 5, 2024
1 parent 2d2160b commit 6498d41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 25 deletions.
3 changes: 1 addition & 2 deletions .github/scripts/flamegraph.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 1 addition & 2 deletions .github/scripts/flamegraph_reth.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
30 changes: 11 additions & 19 deletions .github/workflows/flamegraph_reporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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..."
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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: |

Check failure on line 188 in .github/workflows/flamegraph_reporter.yaml

View workflow job for this annotation

GitHub Actions / Lint

property "flamegraph-ethrex" is not defined in object type {flamegraph: {outputs: {time: string}; result: string}; flamegraph-reth: {outputs: {time: string}; result: string}}
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ <h2>Ethrex</h2>
<a href="flamegraph_ethrex.svg/flamegraph_ethrex.svg"
download="flamegraph_ethrex.svg/flamegraph_ethrex.svg">Download</a>
</div>
<p class="time-elapsed">Time elapsed: {{ETHREX_MIN}}min {{ETHREX_SEC}}s</p>
<p class="time-elapsed">Time elapsed: {{ETHREX_TIME}}</p>
<object id="svg1" data="flamegraph_ethrex.svg/flamegraph_ethrex.svg" type="image/svg+xml" width=100%
height=90%"></object>
</div>
Expand All @@ -27,7 +27,7 @@ <h2>Ethrex</h2>
<h2>Reth</h2>
<a href="flamegraph_reth.svg/flamegraph_reth.svg" download="flamegraph_reth.svg/flamegraph_reth.svg">Download</a>
</div>
<p class="time-elapsed">Time elapsed: {{RETH_MIN}}min {{RETH_SEC}}s</p>
<p class="time-elapsed">Time elapsed: {{RETH_TIME}}</p>
<object id="svg2" data="flamegraph_reth.svg/flamegraph_reth.svg" type="image/svg+xml" width=100%
height=90%></object>
</div>
Expand Down

0 comments on commit 6498d41

Please sign in to comment.