Files

41 lines
867 B
Bash
Raw Permalink Normal View History

#!/usr/bin/env bash
set -eu
2021-01-21 20:55:37 -05:00
declare work_dir=$(pwd)
if [ 'run' = "$1" ]; then
declare no_exit="--no-exit";
fi
2021-01-21 20:55:37 -05:00
cd $PROJECT_DIR
echo "Running 'codecept $@' in Docker..."
2021-01-21 20:55:37 -05:00
~/.composer/vendor/bin/codecept $@ --env docker --no-redirect $no_exit
if [ 'run' = "$1" ]; then
2021-01-21 20:55:37 -05:00
declare test_output="tests/_output";
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
# 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