summaryrefslogtreecommitdiff
path: root/scripts/benchmark/run-benchmarks-ci-job.sh
blob: b2a8c4173c97a32ad453f190b07ed11637d88d6d (plain)
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
#!/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
set -o xtrace

ENVIRONMENT=${1}
RUN_BENCHMARKS=${RUN_BENCHMARKS:-}

if [ -z "${RUN_BENCHMARKS}" ]; then
  echo "Skipping benchmarks because RUN_BENCHMARKS is not set..."
  exit 0
fi

echo "Running tox in environment ${ENVIRONMENT}..."

/usr/bin/unbuffer \
  tox \
    --recreate \
    -e ${ENVIRONMENT} \
    -- \
    --couch-url http://couchdb:5984 \
  | /usr/bin/ts -s