forked from tailcallhq/tailcall
-
Notifications
You must be signed in to change notification settings - Fork 1
119 lines (106 loc) · 4.16 KB
/
benchmarks_and_build.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
name: Benchmarks and build time
on:
push:
branches:
- "**"
pull_request:
branches: [main]
types: [opened, reopened, synchronize]
workflow_dispatch:
inputs:
branch:
description: "Branch to run benchmark on"
required: true
default: "main"
jobs:
Criterion_benchmarks:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmark')
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run json_like_bench
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
uses: boa-dev/[email protected]
with:
benchName: json_like_bench
defaultFeatures: false
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run impl_path_string_for_evaluation_context
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
uses: boa-dev/[email protected]
with:
benchName: impl_path_string_for_evaluation_context
defaultFeatures: false
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run data_loader_bench
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
uses: boa-dev/[email protected]
with:
benchName: data_loader_bench
defaultFeatures: false
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run request_template_bench
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
uses: boa-dev/[email protected]
with:
benchName: request_template_bench
defaultFeatures: false
branchName: ${{ github.base_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Benchmark Changes
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
run: |
output=$(/home/runner/.cargo/bin/critcmp base changes)
echo "$output"
awk 'NR > 2 {
group=$1
base=$7
changes=$3
gsub(/[^\-0-9\.]/, "", changes)
gsub(/[^\-0-9\.]/, "", base)
if (changes != "" && base != "") {
diff = changes - base
percentage = (diff / base) * 100
if (percentage > 10) {
printf "Percentage change for %s exceeds 10%%: %.2f%%\n", group, percentage
exit 1
}
}
}' <<< "$output"
iai-callgrind:
name: iai-callgrind
on:
push:
branches:
- "**"
release:
types:
- published
jobs:
benchmark:
name: build_time_check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install iai-callgrind-runner
run: cargo install --version 0.7.3 iai-callgrind-runner
- name: Install Valgrind
run: sudo apt-get update && sudo apt-get install valgrind
- name: Run Benchmarks
run: |
echo -n > benches/iai-callgrind/benchmarks.txt
cargo bench --bench json_like_bench_iai-callgrind -- --save-baseline change >> benches/iai-callgrind/benchmarks.txt
cargo bench --bench data_loader_bench_iai-callgrind -- --save-baseline change >> benches/iai-callgrind/benchmarks.txt
cargo bench --bench impl_path_string_for_evaluation_context_iai-callgrind -- --save-baseline change >> benches/iai-callgrind/benchmarks.txt
cargo bench --bench request_template_bench_iai-callgrind -- --save-baseline change >> benches/iai-callgrind/benchmarks.txt
- name: Manipulate Benchmark File
run: sed -i 's/ \{1,\}\([0-9]\)/\1/g' benches/iai-callgrind/benchmarks.txt
- name: Execute build_time_compare.sh
run: |
chmod +x .github/scripts/build_time_compare.sh
./.github/scripts/build_time_compare.sh