From fe7e9fc7c0467bb988577f8ee4e6fa3ede39f19d Mon Sep 17 00:00:00 2001 From: Erik van Oosten Date: Sun, 12 Nov 2023 11:06:21 +0100 Subject: [PATCH 1/4] Automatically add new flame graphs --- .github/workflows/profile.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/profile.yml b/.github/workflows/profile.yml index 2fb39ddbe..af4f1e581 100644 --- a/.github/workflows/profile.yml +++ b/.github/workflows/profile.yml @@ -17,7 +17,7 @@ jobs: 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@v3.0.2 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Java @@ -57,10 +57,12 @@ jobs: mv .jvmopts_old .jvmopts cat .jvmopts - - name: Store flamegraphs + - name: Store flame graphs run: | - git config pull.rebase true - export REV=$(git rev-parse --short HEAD) + 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.event.pull_request.head.sha }}) + HTML_LINE="
  • $COMMIT_DATE $COMMIT_TIME Flame graphs for $REV $COMMIT_MSG
  • " ls -al zio-kafka-bench/ mv zio-kafka-bench/zio.kafka.bench.* /tmp git clean -fdx @@ -70,9 +72,10 @@ jobs: 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 "flamegraphs for $REV" + git commit -m "Flame graphs for $REV" git push \ No newline at end of file From 4968a7348bb84a523389a30d1be07c5e071672e8 Mon Sep 17 00:00:00 2001 From: Erik van Oosten Date: Sun, 12 Nov 2023 19:53:37 +0100 Subject: [PATCH 2/4] Automatically prune history --- .github/workflows/profile.yml | 4 ++++ .gitignore | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/profile.yml b/.github/workflows/profile.yml index af4f1e581..e721d68b8 100644 --- a/.github/workflows/profile.yml +++ b/.github/workflows/profile.yml @@ -26,6 +26,8 @@ jobs: distribution: temurin java-version: 17 check-latest: true + - uses: coursier/cache-action@v6 + - uses: VirtusLab/scala-cli-setup@main - name: Use CI sbt jvmopts shell: bash run: | @@ -68,6 +70,7 @@ jobs: git clean -fdx git checkout gh-pages git pull + scala-cli scripts/prune-flame-graph.sc mkdir -p dev/profile/$REV mv /tmp/zio.kafka.bench.* dev/profile/$REV cd dev/profile @@ -76,6 +79,7 @@ jobs: cd ../../ git config --global user.name "zio-kafka CI" git config --global user.email "ziokafkaci@users.noreply.github.com" + git ls-files --deleted | xargs git rm git add . git commit -m "Flame graphs for $REV" git push \ No newline at end of file diff --git a/.gitignore b/.gitignore index ee9014b9b..3a8991a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -71,3 +71,6 @@ project/plugins/project/ # MacOS .DS_Store + +#scala-cli +.scala-build/ From e6f9244f74c3e73bbb714d7f2915d477358bf0f4 Mon Sep 17 00:00:00 2001 From: Erik van Oosten Date: Wed, 15 Nov 2023 19:12:49 +0100 Subject: [PATCH 3/4] More logging, deletes done in prune-flame-graph.sc --- .github/workflows/profile.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/profile.yml b/.github/workflows/profile.yml index e721d68b8..876fc4ea2 100644 --- a/.github/workflows/profile.yml +++ b/.github/workflows/profile.yml @@ -61,25 +61,30 @@ jobs: - name: Store flame graphs run: | + echo "Collecting new flame graph" 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.event.pull_request.head.sha }}) HTML_LINE="
  • $COMMIT_DATE $COMMIT_TIME Flame graphs for $REV $COMMIT_MSG
  • " + echo "::group::Content of zio-kafka-bench directory" ls -al zio-kafka-bench/ + echo "::endgroup::" mv zio-kafka-bench/zio.kafka.bench.* /tmp + echo "Checkout gh-pages branch" git clean -fdx git checkout gh-pages git pull + git config --global user.name "zio-kafka CI" + git config --global user.email "ziokafkaci@users.noreply.github.com" + echo "Remove old flame graphs" scala-cli scripts/prune-flame-graph.sc + echo "Adding new flame graph" 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 ls-files --deleted | xargs git rm git add . git commit -m "Flame graphs for $REV" - git push \ No newline at end of file + git push From ba6454f637279717b091b88e3cced746aabef426 Mon Sep 17 00:00:00 2001 From: Erik van Oosten Date: Thu, 16 Nov 2023 08:44:14 +0100 Subject: [PATCH 4/4] Make output nicer --- .github/workflows/profile.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/profile.yml b/.github/workflows/profile.yml index 876fc4ea2..c8d7c7d6e 100644 --- a/.github/workflows/profile.yml +++ b/.github/workflows/profile.yml @@ -61,6 +61,7 @@ jobs: - name: Store flame graphs run: | + echo "Store flame graphs" echo "Collecting new flame graph" git config pull.rebase true read REV COMMIT_DATE COMMIT_TIME COMMIT_TZ COMMIT_MSG <<< \ @@ -70,15 +71,16 @@ jobs: ls -al zio-kafka-bench/ echo "::endgroup::" mv zio-kafka-bench/zio.kafka.bench.* /tmp - echo "Checkout gh-pages branch" + echo "::group::Checkout gh-pages branch" git clean -fdx git checkout gh-pages git pull git config --global user.name "zio-kafka CI" git config --global user.email "ziokafkaci@users.noreply.github.com" + echo "::endgroup::" echo "Remove old flame graphs" scala-cli scripts/prune-flame-graph.sc - echo "Adding new flame graph" + echo "::group::Adding new flame graph" mkdir -p dev/profile/$REV mv /tmp/zio.kafka.bench.* dev/profile/$REV cd dev/profile @@ -88,3 +90,4 @@ jobs: git add . git commit -m "Flame graphs for $REV" git push + echo "::endgroup::"