test: run-test.sh now works inside a container

The `run-test.sh` helper is meant to execute the tests as if it
was CI but using a container. If it is detected that we are
already running inside a container assume it is prepare so that
we can exectue the tests directly and do so.
This commit is contained in:
Christian Kellner 2022-01-17 16:52:28 +00:00 committed by Achilleas Koutsou
parent a841845688
commit 07b376e02f

View file

@ -4,12 +4,21 @@ set -euo pipefail
SHELLCHECK_SEVERITY=${SHELLCHECK_SEVERITY:-warning}
run_test() {
if [ -f /.dockerenv ]; then
eval "$1"
return
fi
podman run --rm -it -v "$(pwd)":/github/workspace:z --env "GITHUB_WORKSPACE=/github/workspace" koji.test "$1"
}
if [ ! -f /.dockerenv ]; then
pushd test
podman build -t koji.test -f Dockerfile .
popd
else
echo "Container detected, direct mode."
fi
SCRIPTS="$(git ls-files --exclude='*.sh' --ignored | xargs echo)"