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:
parent
a841845688
commit
07b376e02f
1 changed files with 12 additions and 3 deletions
15
run-tests.sh
15
run-tests.sh
|
|
@ -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"
|
||||
}
|
||||
|
||||
pushd test
|
||||
podman build -t koji.test -f Dockerfile .
|
||||
popd
|
||||
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)"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue