-
Notifications
You must be signed in to change notification settings - Fork 55
107 lines (100 loc) · 3.85 KB
/
benchmark_regression_test.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
107
name: Benchmark Regression Check
on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- '**.go'
- 'go.*'
- 'cmd/go.*'
- 'Makefile'
- 'Dockerfile'
- 'integration/**'
- 'scripts/**'
- '.github/workflows/**'
jobs:
run_benchmark_twice:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20.6'
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
- run: make
- name: Run benchmark
run: make benchmarks-perf-test
- name: Upload latest benchmark result
uses: actions/upload-artifact@v3
with:
name: benchmark-result-artifact-main
path: ${{github.workspace}}/benchmark/performanceTest/output/results.json
- name: remove output directory
run: sudo rm -rf ${{ github.workspace }}/benchmark/performanceTest/output
- name: Stash uncommitted changes
run: git stash push --keep-index --include-untracked -m "Stashing changes for tests"
- name: Check out PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- run: make
- name: Run benchmark
run: make benchmarks-perf-test
- name: Upload latest benchmark result
uses: actions/upload-artifact@v3
with:
name: benchmark-result-artifact-pr
path: ${{github.workspace}}/benchmark/performanceTest/output/results.json
download_and_perform_comparison:
runs-on: ubuntu-20.04
needs: run_benchmark_twice
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.18.10'
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
- run: make
- name: Install basic calculator
run: sudo apt-get install bc
- name: Create previous directory
run: mkdir -v ${{ github.workspace }}/previous
- name: Create current directory
run: mkdir -v ${{ github.workspace }}/current
- name: Download previous benchmark result
uses: actions/download-artifact@v3
with:
name: benchmark-result-artifact-main
path: ${{github.workspace}}/previous
- name: Download current benchmark result
uses: actions/download-artifact@v3
with:
name: benchmark-result-artifact-pr
path: ${{github.workspace}}/current
- name: Perform Comparison and log results
id: run-compare
run: |
sudo chmod +x ${{ github.workspace }}/scripts/check_regression.sh
if sudo ${{ github.workspace }}/scripts/check_regression.sh ${{ github.workspace }}/previous/results.json ${{github.workspace}}/current/results.json; then
echo "Comparison successful. All P90 values are within the acceptable range."
else
echo "Comparison failed. Current P90 values exceed 150% threshold of the corresponding past values."
echo "regression-detected=true" >> $GITHUB_OUTPUT
fi
- name: Stop the workflow if regression is detected
if: steps.run-compare.outputs.regression-detected == 'true'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = `
:warning: **Regression Detected** :warning:
The benchmark comparison indicates that there has been a performance regression.
Please investigate and address the issue.
To Investigate check logs of the previous job above.
`;
core.setFailed(comment);