-
Notifications
You must be signed in to change notification settings - Fork 141
106 lines (97 loc) · 3.83 KB
/
benchs.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
94
95
96
97
98
99
100
101
102
103
104
105
106
# Inspired by Flavio W. Brasil's work on Kyo: https://github.com/fwbrasil/kyo
name: Benchs
on:
push:
branches:
- master
pull_request:
types: [ opened, reopened, synchronize ]
branches-ignore:
- gh-pages
# Prevent multiple builds at the same time from the same branch (except for 'master').
concurrency:
group: ${{ github.workflow }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.run_id || github.ref }}
cancel-in-progress: true
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
benchmark: # See https://github.com/marketplace/actions/continuous-benchmark
name: Run benchmark
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.head.repo.fork }} # comes from https://github.com/orgs/community/discussions/25217#discussioncomment-3246904
steps:
- name: Checkout current branch
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
- 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: compile
run: sbt compile
- name: run benchmarks
# To list all possible options and understand these configurations, see run `sbt "zioKafkaBench/Jmh/run -h"`
#
# Used options meaning:
# - "-wi 5": 5 warmup iterations
# - "-i 5": 5 benchmark iterations
# - "-r 1": Minimum time to spend at each measurement iteration. 1 second
# - "-w 1": Minimum time to spend at each warmup iteration. 1 second
# - "-t 1": Number of worker threads to run with. 1 thread
# - "-rf json": Format type for machine-readable results. JSON
# - "-foe true": Should JMH fail immediately if any benchmark had experienced an unrecoverable error?. True
# - "-to 60": 1 minute timeout per iteration
run: sbt "zioKafkaBench/Jmh/run -wi 5 -i 5 -r 1 -w 1 -t 1 -to 120 -rf json -foe true"
- name: Download previous benchmark data
uses: actions/cache@v3
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Rollback - Use CI sbt jvmopts
shell: bash
run: |
mv .jvmopts .jvmopts-ci
mv .jvmopts_old .jvmopts
cat .jvmopts
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: JMH Benchmark
tool: 'jmh'
output-file-path: zio-kafka-bench/jmh-result.json
# Access token to deploy GitHub Pages branch
github-token: ${{ secrets.GITHUB_TOKEN }}
# Push and deploy GitHub pages branch automatically
auto-push: true
alert-threshold: '200%'
comment-on-alert: true
fail-on-alert: true
# Mention these maintainers in the commit comment
alert-comment-cc-users: '@svroonland,@guizmaii,@erikvanoosten'
- name: Prune benchmark history
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "::group::Checkout gh-pages branch"
git clean -fdx
git checkout gh-pages
git branch --set-upstream-to=origin/gh-pages gh-pages
git pull --rebase
git config --global user.name "zio-kafka CI"
git config --global user.email "[email protected]"
echo "::endgroup::"
echo "Prune benchmark history"
scala-cli scripts/prune-benchmark-history.sc
git push