Debian Codegraph @

ansible_collections/community/docker/.azure-pipelines/scripts/run-tests.sh

raw
1 #!/usr/bin/env bash
2 # Configure the test environment and run the tests.
3
4 # Copyright (c) Ansible Project
5 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
6 # SPDX-License-Identifier: GPL-3.0-or-later
7
8 set -o pipefail -eu
9
10 entry_point="$1"
11 test="$2"
12 read -r -a coverage_branches <<< "$3" # space separated list of branches to run code coverage on for scheduled builds
13
14 export COMMIT_MESSAGE
15 export COMPLETE
16 export COVERAGE
17 export IS_PULL_REQUEST
18
19 if [ "${SYSTEM_PULLREQUEST_TARGETBRANCH:-}" ]; then
20 IS_PULL_REQUEST=true
21 COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD^2)
22 else
23 IS_PULL_REQUEST=
24 COMMIT_MESSAGE=$(git log --format=%B -n 1 HEAD)
25 fi
26
27 COMPLETE=
28 COVERAGE=
29
30 if [ "${BUILD_REASON}" = "Schedule" ]; then
31 COMPLETE=yes
32
33 if printf '%s\n' "${coverage_branches[@]}" | grep -q "^${BUILD_SOURCEBRANCHNAME}$"; then
34 COVERAGE=yes
35 fi
36 fi
37
38 "${entry_point}" "${test}" 2>&1 | "$(dirname "$0")/time-command.py"