-
Notifications
You must be signed in to change notification settings - Fork 16
75 lines (75 loc) · 2.52 KB
/
benchmark.yml
File metadata and controls
75 lines (75 loc) · 2.52 KB
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
# SPDX-FileCopyrightText: Copyright (c) 2016-2026 Objectionary.com
# SPDX-License-Identifier: MIT
---
# yamllint disable rule:line-length
name: benchmark
'on':
push:
branches:
- master
paths-ignore: ['README.md', '.github']
concurrency:
group: benchmark-${{ github.ref }}
cancel-in-progress: true
jobs:
benchmark:
timeout-minutes: 15
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: actions/setup-java@v5
with:
distribution: 'zulu'
java-version: 21
- uses: actions/cache@v5
with:
path: ~/.m2/repository
key: ubuntu-jdk-21-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ubuntu-jdk-21-maven-
- run: mvn clean test -Pbenchmark --errors --batch-mode
- run: |
set -x
sum=$(
printf "\`\`\`text\n"
cat target/lint-summary.txt
printf "\n\n"
header=true
while IFS=, read -r id ms; do
if [[ "$id" != "id" ]]; then
if $header; then
header=false
continue
fi
printf "%s,%s\n" "$(echo "$id" | tr -d '"')" "$(echo "$ms" | tr -d '"')"
fi
done < target/timings.csv | sort -t, -k2 -n -r | head -16 | while IFS=, read -r id ms; do
printf "%s (%s ms)\n" "$id" "$ms"
done
printf "\`\`\`\n\n"
echo "The results were calculated in [this GHA job][benchmark-gha]"
echo "on $(date +'%Y-%m-%d') at $(date +'%H:%M'),"
echo "on $(uname) with $(nproc --all) CPUs."
)
export sum
perl -i -0777 -pe 's/(?<=<!-- benchmark_begin -->).*(?=<!-- benchmark_end -->)/\n$ENV{sum}\n/gs;' README.md
url=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}
export url
perl -i -0777 -pe 's/(?<=\[benchmark-gha\]: )[^\n]+(?=\n)/$ENV{url}/gs;' README.md
- uses: peter-evans/create-pull-request@v7
with:
branch: benchmark
commit-message: 'New benchmark results'
delete-branch: true
title: "New benchmark results"
assignees: yegor256
base: master
sign-commits: true
report:
name: Create issue on failure
needs: benchmark
if: failure() && github.event.pull_request == null
runs-on: ubuntu-24.04
steps:
- uses: jayqi/failed-build-issue-action@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}