2 # SPDX-License-Identifier: EPL-1.0
3 ##############################################################################
4 # Copyright (c) 2017 The Linux Foundation and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Eclipse Public License v1.0
8 # which accompanies this distribution, and is available at
9 # http://www.eclipse.org/legal/epl-v10.html
10 ##############################################################################
11 echo "---> tox-run.sh"
13 ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox"
14 mkdir -p "$ARCHIVE_TOX_DIR"
15 cd "$WORKSPACE/$TOX_DIR" || exit 1
17 if [ -d "/opt/pyenv" ]; then
18 echo "---> Setting up pyenv"
19 export PYENV_ROOT="/opt/pyenv"
20 export PATH="$PYENV_ROOT/bin:$PATH"
23 export TOX_TESTENV_PASSENV=PYTHONPATH
26 PARALLEL="${PARALLEL:-true}"
27 if [ "${PARALLEL}" = true ]; then
28 if [ -n "$TOX_ENVS" ]; then
29 tox -e "$TOX_ENVS" --parallel auto --parallel-live | tee -a "$ARCHIVE_TOX_DIR/tox.log"
30 tox_status="${PIPESTATUS[0]}"
32 tox --parallel auto --parallel-live | tee -a "$ARCHIVE_TOX_DIR/tox.log"
33 tox_status="${PIPESTATUS[0]}"
36 if [ -n "$TOX_ENVS" ]; then
37 tox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/tox.log"
38 tox_status="${PIPESTATUS[0]}"
40 tox | tee -a "$ARCHIVE_TOX_DIR/tox.log"
41 tox_status="${PIPESTATUS[0]}"
45 # Disable SC2116 as we want to echo a space separated list of TOX_ENVS
46 # shellcheck disable=SC2116
47 for i in .tox/*/log; do
48 tox_env=$(echo "$i" | awk -F'/' '{print $2}')
49 cp -r "$i" "$ARCHIVE_TOX_DIR/$tox_env"
52 echo "Completed tox runs."
55 # If docs are generated push them to archives.
56 DOC_DIR="${DOC_DIR:-docs/_build/html}"
57 if [[ -d "$DOC_DIR" ]]; then
58 echo "---> Archiving generated docs"
59 mv "$DOC_DIR" archives/
62 test "$tox_status" -eq 0 || exit "$tox_status"