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

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 - 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 - echo /opt/instantclient_* > /etc/ld.so.conf.d/oracle-instantclient.conf
- ldconfig - ldconfig
- python3 -m venv venv - ./tests.sh
- source venv/bin/activate
- python3 -m pip install -e ".[dev]"
- python3 -m pytest tests
build: build:
image: debian image: debian
commands: 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