-
Notifications
You must be signed in to change notification settings - Fork 137
114 lines (101 loc) · 3.6 KB
/
Copy pathbenchmark.yml
File metadata and controls
114 lines (101 loc) · 3.6 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
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
107
108
109
110
111
112
113
114
name: Benchmark
on:
push:
branches:
- develop
- master
paths:
- 'src/**'
- '.github/workflows/benchmark.yml'
- '.github/scripts/*.*'
- '*gradle*'
- 'gradle/wrapper/gradle-wrapper.properties'
- 'lombok.config'
pull_request:
paths:
- 'src/**'
- '.github/workflows/benchmark.yml'
- '.github/scripts/*.*'
- '*gradle*'
- 'gradle/wrapper/gradle-wrapper.properties'
- 'lombok.config'
# Для pull_request группа общая для всех запусков одного PR - новый коммит отменяет предыдущие запуски.
# Для push (замер ветки с публикацией результата) в группу попадает уникальный run_id,
# поэтому запуски не отменяются.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
check-pr-exists:
runs-on: ubuntu-latest
outputs:
has_pr: ${{ steps.check.outputs.has_pr }}
steps:
- uses: actions/checkout@v7
- name: Check if PR exists for this branch
id: check
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
result=$(.github/scripts/check-pr-exists.sh "${{ github.event_name }}" "${{ github.ref_name }}" "${{ github.repository }}")
echo "has_pr=$result" >> $GITHUB_OUTPUT
Benchmark:
needs: check-pr-exists
if: needs.check-pr-exists.outputs.has_pr != 'true'
runs-on: self-hosted
steps:
- name: Checkout project
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@v5
with:
java-version: 25
distribution: 'corretto'
cache: gradle
- name: Build with Gradle
run: ./gradlew bootJar
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: "3.7"
- name: Setup Python libs
run: pip install pytest pytest-benchmark && pip install pybadges
- name: Download SSL 3.1
run: git clone --depth 1 https://github.com/1c-syntax/ssl_3_1.git ssl
- name: Analyze ssl
run: pytest .github/scripts/benchmark.py --benchmark-min-rounds=3 --benchmark-timer=time.time --benchmark-json=output.json --benchmark-verbose
- name: Archive results in SARIF
uses: actions/upload-artifact@v7
with:
name: "SARIF report"
path: bsl-ls.sarif
- name: Generation badge benchmark
if: github.event_name == 'push'
run: python .github/scripts/gen-bandge.py
- name: Check benchmark result for pull request
if: github.event_name == 'pull_request'
uses: otymko/github-action-benchmark@v1.1
with:
name: BSL LS perfomance measurement (SSL 3.1)
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@otymko"
- name: Store benchmark result into branch
if: github.event_name == 'push'
uses: otymko/github-action-benchmark@v1.1
with:
name: BSL LS perfomance measurement (SSL 3.1)
tool: "pytest"
output-file-path: output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "110%"
comment-on-alert: true
fail-on-alert: false
alert-comment-cc-users: "@otymko"