-
Notifications
You must be signed in to change notification settings - Fork 141
93 lines (87 loc) · 3.33 KB
/
profile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# Copied from Flavio W. Brasil's work on Kyo: https://github.com/fwbrasil/kyo
name: profile
on:
release:
types: [ created ]
workflow_dispatch:
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@v4
with:
distribution: temurin
java-version: 21
check-latest: true
- name: Setup sbt
uses: sbt/setup-sbt@v1
- uses: coursier/cache-action@v6
- uses: VirtusLab/scala-cli-setup@main
- 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: |
echo "Store flame graphs"
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=" <li>$COMMIT_DATE $COMMIT_TIME <a href=\"$REV\">Flame graphs for $REV</a> $COMMIT_MSG</li>"
echo "::group::Content of zio-kafka-bench directory"
ls -al zio-kafka-bench/
echo "::endgroup::"
mv zio-kafka-bench/zio.kafka.bench.* /tmp
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 "[email protected]"
echo "::endgroup::"
echo "Remove old flame graphs"
scala-cli scripts/prune-flame-graph.sc
echo "::group::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 add .
git commit -m "Flame graphs for $REV"
git push
echo "::endgroup::"