2020-09-01 16:12:01 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
2021-01-21 20:55:37 -05:00
|
|
|
declare work_dir=$(pwd)
|
|
|
|
|
|
2020-09-01 16:12:01 -04:00
|
|
|
if [ 'run' = "$1" ]; then
|
|
|
|
|
declare no_exit="--no-exit";
|
|
|
|
|
fi
|
|
|
|
|
|
2021-01-21 20:55:37 -05:00
|
|
|
cd $PROJECT_DIR
|
|
|
|
|
|
2020-09-01 16:12:01 -04:00
|
|
|
echo "Running 'codecept $@' in Docker..."
|
2021-01-21 20:55:37 -05:00
|
|
|
~/.composer/vendor/bin/codecept $@ --env docker --no-redirect $no_exit
|
2020-09-01 16:12:01 -04:00
|
|
|
|
|
|
|
|
if [ 'run' = "$1" ]; then
|
2021-01-21 20:55:37 -05:00
|
|
|
declare test_output="tests/_output";
|
2020-09-01 16:12:01 -04:00
|
|
|
if [ -n "$(ls $test_output )" ]; then
|
|
|
|
|
echo 'Setting result files permissions'.
|
|
|
|
|
chmod 777 -R ${test_output}/*
|
|
|
|
|
fi
|
|
|
|
|
|
2021-01-26 18:14:33 -05:00
|
|
|
# Clean coverage.xml and clean up PCOV configurations.
|
|
|
|
|
if [ -f "${test_output}/coverage.xml" ]; then
|
|
|
|
|
echo 'Cleaning coverage.xml for deployment...'
|
|
|
|
|
pattern="$PROJECT_DIR/"
|
|
|
|
|
sed -i "s~$pattern~~g" "$test_output"/coverage.xml
|
|
|
|
|
fi
|
|
|
|
|
|
2020-09-01 16:12:01 -04:00
|
|
|
# Check results and exit accordingly.
|
|
|
|
|
if [ -f "$test_output/failed" ]; then
|
|
|
|
|
echo "Uh oh, some went wrong." >> /dev/stderr
|
|
|
|
|
exit 1
|
|
|
|
|
else
|
|
|
|
|
echo "Woohoo! It's working!"
|
|
|
|
|
exit 0
|
|
|
|
|
fi
|
|
|
|
|
fi
|
2021-01-21 20:55:37 -05:00
|
|
|
|
|
|
|
|
cd $work_dir
|