summaryrefslogtreecommitdiffstats
path: root/tools/test-setup.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 12:06:49 +0000
commit2fe34b6444502079dc0b84365ce82dbc92de308e (patch)
tree8fedcab52bbbc3db6c5aa909a88a7a7b81685018 /tools/test-setup.sh
parentInitial commit. (diff)
downloadansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.tar.xz
ansible-lint-2fe34b6444502079dc0b84365ce82dbc92de308e.zip
Adding upstream version 6.17.2.upstream/6.17.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xtools/test-setup.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/test-setup.sh b/tools/test-setup.sh
new file mode 100755
index 0000000..79dbcc8
--- /dev/null
+++ b/tools/test-setup.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# This tool is used to setup the environment for running the tests. Its name
+# name and location is based on Zuul CI, which can automatically run it.
+set -euo pipefail
+
+# User specific environment
+# shellcheck disable=SC2076
+if ! [[ "$PATH" =~ "$HOME/.local/bin" ]]
+then
+ PATH="$HOME/.local/bin:$PATH"
+fi
+
+if [ -f "/usr/bin/apt-get" ]; then
+ if [ ! -f "/var/cache/apt/pkgcache.bin" ]; then
+ sudo apt-get update # mandatory or other apt-get commands fail
+ fi
+ # avoid outdated ansible and pipx
+ sudo apt-get remove -y ansible pipx || true
+ # cspell:disable-next-line
+ sudo apt-get install -y --no-install-recommends -o=Dpkg::Use-Pty=0 \
+ curl gcc git python3-venv python3-pip python3-dev libyaml-dev
+ # Some of these might be needed for compiling packages that do not yet
+ # a binary for current platform, like pyyaml on py311
+ # pip3 install -v --no-binary :all: --user pyyaml
+fi
+
+# Log some useful info in case of unexpected failures:
+uname
+python3 --version