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 # Ensure we fail the job if any steps fail.
14 # DO NOT set -u as virtualenv's activate script has unbound variables
17 ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox"
18 mkdir -p "$ARCHIVE_TOX_DIR"
20 cd "$WORKSPACE/$TOX_DIR"
22 if [ -z "$TOX_ENVS" ]; then
23 TOX_ENVS=$(crudini --get tox.ini tox envlist)
30 echo "-----> Running tox $env"
31 if ! tox -e $env > "$log_dir/tox-$env.log"; then
32 echo "$env" >> "$log_dir/failed-envs.log"
36 TOX_ENVS=(${TOX_ENVS//,/ })
37 if hash parallel 2>/dev/null; then
39 parallel --jobs 200% "run_tox $ARCHIVE_TOX_DIR {}" ::: ${TOX_ENVS[*]}
41 for env in "${TOX_ENVS[@]}"; do
42 run_tox "$ARCHIVE_TOX_DIR" "$env"
46 if [ -f "$ARCHIVE_TOX_DIR/failed-envs.log" ]; then
47 failed_envs=($(cat "$ARCHIVE_TOX_DIR/failed-envs.log"))
48 echo "ERROR: Failed the following builds: ${failed_envs[*]}"
52 echo "Completed tox runs."