summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@riseup.net>2017-10-05 07:53:46 -0300
committerdrebs <drebs@riseup.net>2017-10-05 09:43:40 -0300
commitee79459569cd93467afd056412a88d05d2263917 (patch)
tree0408874e3d2d73c99a6c4f8808c533593e8f13bc
parentc1d3d5ee8f26433aa992e8ffdc5384782a8d4c4a (diff)
[tests] run benchmarks conditionally
-rw-r--r--.gitlab-ci.yml5
-rwxr-xr-xscripts/benchmark/run-benchmarks-ci-job.sh31
2 files changed, 34 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1ed0275d..21458c1b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -170,14 +170,15 @@ package:amd64_zesty:
time-cpu:
<<: *benchmark
script:
- - /usr/bin/unbuffer tox --recreate -e benchmark-time-cpu -- --couch-url http://couchdb:5984 | /usr/bin/ts -s
+ - scripts/benchmark/run-benchmarks-ci-job.sh benchmark-time-cpu
memory:
<<: *benchmark
script:
- - /usr/bin/unbuffer tox --recreate -e benchmark-memory -- --couch-url http://couchdb:5984 | /usr/bin/ts -s
+ - scripts/benchmark/run-benchmarks-ci-job.sh benchmark-memory
responsiveness:
<<: *benchmark
script:
+ - scripts/benchmark/run-benchmarks-ci-job.sh responsiveness
- /usr/bin/unbuffer tox --recreate -e responsiveness -- --couch-url http://couchdb:5984 | /usr/bin/ts -s
diff --git a/scripts/benchmark/run-benchmarks-ci-job.sh b/scripts/benchmark/run-benchmarks-ci-job.sh
new file mode 100755
index 00000000..e99a8ab0
--- /dev/null
+++ b/scripts/benchmark/run-benchmarks-ci-job.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# This script is used in .gitlab-ci.yml to run benchmark jobs. It has been
+# factored out from that file to avoid bloating it with too much information.
+#
+# The benchmark job will be skiped if the RUN_BENCHMARKS variable is not set,
+# thus allowing for opting in to benchmarking.
+#
+# This is an attempt to make life of developers easier, by diminishing the time
+# of the pipeline by not running benchmarks by default. The canonical repo
+# (i.e. https://0xacab.org/leap/soledad) should have the RUN_BENCHMARKS
+# variable set to ensure that these jobs will run. Developers can add or remove
+# the variable from their environments as they see fit.
+
+set -eu
+
+ENVIRONMENT=${1}
+RUN_BENCHMARKS=${RUN_BENCHMARKS:-}
+
+if [ -z "${RUN_BENCHMARKS}" ]; then
+ echo "Skipping benchmarks because RUN_BENCHMARKS is not set..."
+ exit 0
+fi
+
+/usr/bin/unbuffer \
+ tox \
+ --recreate
+ -e ${ENVIRONMENT} \
+ -- \
+ --couch-url http://couchdb:5984 \
+ | /usr/bin/ts -s