@@ -9,11 +9,15 @@ on: pull_request
99# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_call
1010# https://docs.github.com/en/actions/learn-github-actions/contexts#about-contexts-and-expressions
1111
12+# You can override the default DIFF_CUTOFF_PERCENT by specifying a cutoff along
13+# with the benchmark target.
14+# Eg, "Data.Async:12" where "Data.Async" is the benchmark target, ":" is the
15+# seperator, and "12" is the new cutoff percent
1216jobs:
1317 check-regressions:
1418 env:
1519 BENCH_SH: bin/bench.sh
16− BENCHMARKS: >-
20+ BENCHMARKS_WITH_CUTOFF: >-
1721 Data.Array
1822 Data.Array.Foreign
1923 Data.Array.Prim
@@ -25,14 +29,14 @@ jobs:
2529 Data.SmallArray
2630 Data.Stream.StreamD
2731 Data.Stream.StreamDK
28− Data.Stream.StreamK
32+ Data.Stream.StreamK:6
2933 Data.Unfold
3034 FileSystem.Handle
3135 Prelude.Ahead
32− Prelude.Async
36+ Prelude.Async:12
3337 Prelude.Parallel
3438 Prelude.Serial
35− Prelude.WAsync
39+ Prelude.WAsync:6
3640 Prelude.WSerial
3741 Prelude.ZipAsync
3842 Prelude.ZipSerial
@@ -46,6 +50,16 @@ jobs:
4650
4751 steps:
4852
53+ - name: Update environment
54+ run: |
55+ BENCHMARKS=""
56+ for i in $BENCHMARKS_WITH_CUTOFF
57+ do
58+ bname=$(echo "$i" | cut -d: -f1)
59+ BENCHMARKS="$BENCHMARKS $bname"
60+ done
61+ echo "BENCHMARKS=$BENCHMARKS" >> $GITHUB_ENV
62+
4963 - name: Setup haskell
5064 uses: actions/setup-haskell@v1
5165 with:
@@ -113,9 +127,27 @@ jobs:
113127 - name: Compare benchmarks
114128 run: |
115129 chmod +x $BENCH_SH
116− ! $BENCH_SH --benchmarks "$BENCHMARKS" \
117− --fields "$FIELDS" \
118− --no-measure \
119− --silent --append \
120− --diff-cutoff-percent $DIFF_CUTOFF_PERCENT \
121− | grep -v "^$"
130+
131+ EXIT_STATUS=0
132+
133+ for i in $BENCHMARKS_WITH_CUTOFF
134+ do
135+ arrI=(${i//:/ })
136+
137+ bname=${arrI[0]}
138+ cutoff=${arrI[1]}
139+
140+ test -z "$cutoff" && cutoff=$DIFF_CUTOFF_PERCENT
141+
142+ echo
143+ echo "Checking $bname for regressions greater than $cutoff percent"
144+ ! $BENCH_SH --benchmarks "$bname" \
145+ --fields "$FIELDS" \
146+ --no-measure \
147+ --silent --append \
148+ --diff-cutoff-percent $cutoff \
149+ | grep -v "^$"
150+ test $? -eq 1 && EXIT_STATUS=1
151+ done
152+
153+ exit $EXIT_STATUS