-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (107 loc) · 3.65 KB
/
benchmark.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
on:
pull_request:
push:
branches:
- master
- main
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BENCHMARK_FLAGS: --reporter console::out=-::colour-mode=ansi --rng-seed=0xBEEF
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/cache@v4
with:
path: build/_deps/*-src
key: cmake-dependency-src-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
cmake-dependency-src-
- uses: actions/cache@v4
with:
path: |
build/_deps/*-build
build/_deps/*-subbuild
key: cmake-dependency-builds-${{ runner.os }}-benchmark-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
cmake-dependency-builds-${{ runner.os }}-benchmark-
cmake-dependency-builds-${{ runner.os }}-
- name: Configure and Build Project
uses: threeal/[email protected]
with:
run-build: true
# release
options: CMAKE_BUILD_TYPE=Release
build-args: --config Release --target Benchmark
- name: Run Benchmark
run: |
./build/benchmark/Benchmark --reporter XML::out=./build/test/benchmark-report.xml ${{ env.BENCHMARK_FLAGS }}
- uses: actions/upload-artifact@v4
with:
name: benchmark-result
path: ./build/test/benchmark-report.xml
benchmark-target:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
submodules: 'recursive'
- uses: actions/cache@v4
with:
path: build/_deps/*-src
key: cmake-dependency-src-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
cmake-dependency-src-
- uses: actions/cache@v4
with:
path: |
build/_deps/*-build
build/_deps/*-subbuild
key: cmake-dependency-builds-${{ runner.os }}-benchmark-${{ hashFiles('**/CMakeLists.txt') }}
restore-keys: |
cmake-dependency-builds-${{ runner.os }}-benchmark-
cmake-dependency-builds-${{ runner.os }}-
- name: Configure and Build Project
uses: threeal/[email protected]
with:
run-build: true
# release
options: CMAKE_BUILD_TYPE=Release
build-args: --config Release --target Benchmark
- name: Run Benchmark
run: |
./build/benchmark/Benchmark --reporter XML::out=./build/test/benchmark-report-target.xml ${{ env.BENCHMARK_FLAGS }}
- uses: actions/upload-artifact@v4
with:
name: benchmark-result-target
path: ./build/test/benchmark-report-target.xml
comment:
needs: [benchmark, benchmark-target]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: benchmark-result*
path: ./build/test
merge-multiple: true
- name: Setup Python3
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Run compare script
run: |
python3 ./.github/scripts/compare-benchmarks.py ./build/test/benchmark-report-target.xml ./build/test/benchmark-report.xml | tee ./build/test/compare.txt
shell: bash
- uses: thollander/actions-comment-pull-request@v2
with:
filePath: ./build/test/compare.txt
comment_tag: benchmark