Skip to content

Automatically add new flame graphs to gh_pages, prune old #1252

Automatically add new flame graphs to gh_pages, prune old

Automatically add new flame graphs to gh_pages, prune old #1252

Workflow file for this run

# Copied from Flavio W. Brasil's work on Kyo: https://github.com/fwbrasil/kyo
name: profile
on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]
permissions:
contents: write
deployments: write
jobs:
benchmark:
name: Profile benchmarks
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }} # comes from https://github.com/orgs/community/discussions/25217#discussioncomment-3246904
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# - name: Setup Java
# uses: actions/setup-java@v3.12.0
# with:
# distribution: temurin
# java-version: 17
# check-latest: true
# - name: Use CI sbt jvmopts
# shell: bash
# run: |
# mv .jvmopts .jvmopts_old
# mv .jvmopts-ci .jvmopts
# cat .jvmopts
#
# - name: install async-profiler
# run: |
# ls -al
# cd /home/runner
# wget https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.9/async-profiler-2.9-linux-x64.tar.gz
# tar -xvzf async-profiler-2.9-linux-x64.tar.gz
# sudo mkdir -p /usr/java/packages/lib/
# sudo cp async-profiler-2.9-linux-x64/build/libasyncProfiler.so /usr/java/packages/lib/
# sudo sysctl kernel.perf_event_paranoid=1
# sudo sysctl kernel.kptr_restrict=0
#
# - name: run benchmarks
# run: |
# ls -al
# cd /home/runner/work/zio-kafka/zio-kafka/
# sbt "zioKafkaBench/Jmh/run -wi 10 -i 10 -r 1 -w 1 -t 1 -rf json -foe true -prof async:output=flamegraph"
#
# - name: Rollback - Use CI sbt jvmopts
# shell: bash
# run: |
# mv .jvmopts .jvmopts-ci
# mv .jvmopts_old .jvmopts
# cat .jvmopts
- name: Store flame graphs
run: |
git config pull.rebase true
read REV COMMIT_DATE COMMIT_TIME COMMIT_TZ COMMIT_MSG <<< $(git log --pretty=format:'%h %ad %s' --date=iso8601 -n 1 ${{ github.sha }})
HTML_LINE=" <li>$COMMIT_DATE $COMMIT_TIME <a href=\"$REV\">Flame graphs for $REV</a> $COMMIT_MSG</li>"
ls -al zio-kafka-bench/
mv zio-kafka-bench/zio.kafka.bench.* /tmp
git clean -fdx
git checkout gh-pages
git pull
mkdir -p dev/profile/$REV
mv /tmp/zio.kafka.bench.* dev/profile/$REV
cd dev/profile
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && tree -H . -o index.html" \;
sed -i'' -e '/NEW-FLAME-GRAPHS-GO-HERE/a\'$'\n'"$HTML_LINE"$'\n' index.html
cd ../../
git config --global user.name "zio-kafka CI"
git config --global user.email "ziokafkaci@users.noreply.github.com"
git add .
git commit -m "Flame graphs for $REV"
git push