refactor: use matrix style #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Flamegraph Reporter LEVM | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: ["main", "levm/perf/automate_flamegraph"] | |
workflow_dispatch: | |
jobs: | |
generate-flamegraph: | |
name: Generate Flamegraph | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
name: ["levm", "revm"] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Rustup toolchain install | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache Extra Binaries | |
id: cache-binaries | |
uses: actions/cache@v4 | |
with: | |
path: | | |
${{ env.HOME }}/.cargo/bin/addr2line | |
${{ env.HOME }}/.cargo/bin/flamegraph | |
${{ env.HOME }}/.cargo/bin/inferno-* | |
${{ env.HOME }}/ethrex/ethrex/cmd/ef_tests/levm/vectors | |
key: ${{ runner.os }}-${{ env.RUST_VERSION }}-extra-binaries | |
- name: Install flamegraph tools | |
run: | | |
if [ ! -f "$HOME/.cargo/bin/flamegraph" ]; then | |
cargo install --force flamegraph | |
else | |
echo "$HOME/.cargo/bin/flamegraph already found" | |
fi | |
if [ ! -f "$HOME/.cargo/bin/inferno-collapse-perf" ]; then | |
cargo install --force inferno | |
else | |
echo "$HOME/.cargo/bin/inferno-collapse-perf already found" | |
fi | |
- name: Download EF Tests | |
run: | | |
if [ ! -f "$HOME/ethrex/ethrex/cmd/ef_tests/levm/vectors" ]; then | |
cd crates/vm/levm | |
make download-evm-ef-tests | |
fi | |
- name: Generate Flamegraph data for ${{ matrix.name }} | |
run: | | |
if [ "${{ matrix.name }}" == "levm" ]; then | |
rm -rf target/debug/ef_tests_levm \ | |
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" \ | |
-p ef_tests-levm | |
elif [ "${{ matrix.name }}" == "revm" ]; then | |
rm -rf target/debug/ef_tests_levm \ | |
CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph -c "record -o perf.data -F997 --call-graph dwarf,16384 -g" \ | |
-p ef_tests-levm -- --revm | |
fi | |
- name: Upload artifact - ${{ matrix.name }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: flamegraph_${{ matrix.name }}.svg | |
path: ./flamegraph_${{ matrix.name }}.svg | |
upload-static-page: | |
name: Upload artifacts for static page | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }}/levm | |
needs: [generate-flamegraph] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Download ethrex flamegraph artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: flamegraph_levm.svg | |
path: flamegraph_levm.svg | |
- name: Download reth flamegraph artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: flamegraph_revm.svg | |
path: flamegraph_revm.svg | |
- name: Update static page locally with new data | |
shell: bash | |
run: | | |
cp -r flamegraph_levm.svg pages/ | |
cp -r flamegraph_revm.svg pages/ | |
sed -i "s/{{LAST_UPDATE}}/$(TZ='Etc/GMT+3' date +'%Y-%m-%dT%H:%M:%S')/g" pages/index.html | |
sed -i "s/{{ETHREX_TIME}}/${{ needs.flamegraph-levm.outputs.time }}/g" pages/index.html | |
sed -i "s/{{RETH_TIME}}/${{ needs.flamegraph-revm.outputs.time }}/g" pages/index.html | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "pages/" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |