diff --git a/.woodpecker.yml b/.woodpecker.yml index 82da5dc..fc3b6b2 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -9,10 +9,7 @@ pipeline: - unzip -d /opt /opt/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip - echo /opt/instantclient_* > /etc/ld.so.conf.d/oracle-instantclient.conf - ldconfig - - python3 -m venv venv - - source venv/bin/activate - - python3 -m pip install -e ".[dev]" - - python3 -m pytest tests + - ./tests.sh build: image: debian commands: diff --git a/tests.sh b/tests.sh new file mode 100755 index 0000000..d50833d --- /dev/null +++ b/tests.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +# Enter source directory +cd $( dirname $0 ) + +if [ -d venv ] +then + VENV=$( realpath venv ) + TEMP_VENV=0 +else + # Install stdeb in temporary venv + VENV=$(mktemp -d) + echo "Create a temporary virtualenv in $VENV to install build dependencies..." + TEMP_VENV=1 + python3 -m venv $VENV +fi + +# Install package with dev dependencies +$VENV/bin/python3 -m pip install -e ".[dev]" + +# Run tests +$VENV/bin/python3 -m pytest tests +RES=$? + +# Clean temporary venv +[ $TEMP_VENV -eq 1 ] && rm -fr $VENV + +exit $RES