Add tests.sh script and use it for CI step to fix sh shell problems
ci/woodpecker/push/woodpecker Pipeline failed Details

This commit is contained in:
Benjamin Renard 2022-04-27 18:02:54 +02:00
parent 735ba92646
commit a0e7aae504
2 changed files with 29 additions and 4 deletions

View File

@ -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:

28
tests.sh Executable file
View File

@ -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