-
Notifications
You must be signed in to change notification settings - Fork 67
174 lines (145 loc) · 5.31 KB
/
regression-check.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Regression checking
on:
workflow_dispatch:
pull_request:
# References:
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#reusable-workflows-and-starter-workflows
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_call
# https://docs.github.com/en/actions/learn-github-actions/contexts#about-contexts-and-expressions
# You can override the default DIFF_CUTOFF_PERCENT by specifying a cutoff along
# with the benchmark target.
# Eg, "Data.Async:12" where "Data.Async" is the benchmark target, ":" is the
# seperator, and "12" is the new cutoff percent
#----------------------------------------------------------------------
#-- Benchmarks listed in alphabetical order
#----------------------------------------------------------------------
jobs:
check-regressions:
env:
CI_BENCHMARKS_WITH_CUTOFF: >-
Data.Array
Data.Array.Generic
Data.Array.Stream
Data.Fold
Data.Fold.Prelude
Data.Fold.Window
Data.MutArray
Data.Parser
Data.ParserK
Data.ParserK.Chunked
Data.ParserK.Chunked.Generic
Data.RingArray
Data.Scanl.Window
Data.Serialize
Data.Stream
Data.Stream.Concurrent
Data.Stream.ConcurrentEager
Data.Stream.ConcurrentInterleaved
Data.Stream.ConcurrentOrdered
Data.StreamK:6
Data.Unbox
Data.Unbox.Derive.TH
Data.Unfold
FileSystem.Handle
Unicode.Parser
Unicode.Stream
CI_FIELDS: allocated
CI_DIFF_CUTOFF_PERCENT: 3
runs-on: ubuntu-latest
steps:
- name: Update environment
run: |
CI_BENCHMARKS=""
for i in $CI_BENCHMARKS_WITH_CUTOFF
do
bname=$(echo "$i" | cut -d: -f1)
CI_BENCHMARKS="$CI_BENCHMARKS $bname"
done
echo "CI_BENCHMARKS=$CI_BENCHMARKS" >> $GITHUB_ENV
- name: Download ghc
run: |
GHCUP_VER=0.1.18.0
curl -sL -o ./ghcup https://downloads.haskell.org/~ghcup/$GHCUP_VER/x86_64-linux-ghcup-$GHCUP_VER
chmod +x ./ghcup
GHCVER=9.2.7
./ghcup install ghc $GHCVER
./ghcup set ghc $GHCVER
cabal update
- uses: actions/cache@v2
name: Cache ~/.cabal
with:
path: |
~/.cabal
# Bump the key version to clear the cache
key: cache-v2
- name: Cache bench-runner from pr
id: cache-bench-runner-pr
uses: actions/cache@v2
with:
path: bench-runner
# Bump the key version to clear the cache
key: bench-runner-v1
# -----------------------------------------------------------------
# -- Install bench-report in the current directory
# -----------------------------------------------------------------
- name: Checkout the current branch
uses: actions/checkout@v2
with:
clean: false
- name: Install bench-runner
run: |
cabal install bench-runner --project-file=cabal.project.report --installdir=./
# -----------------------------------------------------------------
# -- Generate reports for the base branch and upload
# -----------------------------------------------------------------
- name: Checkout the base branch
uses: actions/checkout@v2
with:
ref: master
clean: false
- name: Run benchmarks
run: |
./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --raw
- name: Move charts to charts-master
run: mv charts charts-master
# -----------------------------------------------------------------
# -- Download, generate reports for the current branch and append
# -----------------------------------------------------------------
- name: Checkout the current branch
uses: actions/checkout@v2
with:
clean: false
- name: Copy charts-master to charts
run: cp -r charts-master charts
- name: Run benchmarks and append
run: |
./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --raw --append
# -----------------------------------------------------------------
# -- Compare
# -----------------------------------------------------------------
- name: List all benchmarks
run: |
./bench-runner --package-name streamly-benchmarks --package-version 0.0.0 --targets "$CI_BENCHMARKS" --no-measure
- name: Compare benchmarks
run: |
EXIT_STATUS=0
for i in $CI_BENCHMARKS_WITH_CUTOFF
do
arrI=(${i//:/ })
bname=${arrI[0]}
cutoff=${arrI[1]}
test -z "$cutoff" && cutoff=$CI_DIFF_CUTOFF_PERCENT
echo
echo "Checking $bname for regressions greater than $cutoff percent"
! ./bench-runner \
--package-name streamly-benchmarks \
--package-version 0.0.0 \
--targets "$bname" \
--fields "$CI_FIELDS" \
--no-measure --silent \
--diff-cutoff-percent $cutoff \
| grep -v "^$"
test $? -eq 1 && EXIT_STATUS=1
done
exit $EXIT_STATUS