Select Git revision

David Beniamine authored
ci-job.sh 1.09 KiB
#!/bin/bash
REDBOLD='\033[0;31;1m'
GREENBOLD='\033[0;32;1m'
BOLD='\033[1m'
NORMAL='\033[0m'
run_step(){
name=$1
shift
echo -e "${BOLD} Running step : $name ${NORMAL}"
$@
ret=$?
if [ $ret -ne 0 ];
then
echo -e "${REDBOLD}$name failed${NORMAL}"
exit $ret
else
echo -e "${GREENBOLD}$name sucess${NORMAL}"
fi
}
cd $(dirname $(dirname $0))
if [ ! -f ".env" ]; then
cp .env.test .env
fi
run_step "Starting apache" apache2ctl -DFOREGROUND &
run_step "PHP dependencies" composer install
run_step "Javascript dependencies" npm install
run_step "Assets compilation" npm run dev
echo "Waiting for mysql to be up and running"
until nc -z -v -w30 mysql 3306; do
sleep 5
done
echo "Doctrine create DB"
php bin/console doctrine:migrations:migrate --no-interaction --env=test
echo "Doctrine load fixtures"
php bin/console doctrine:fixtures:load --no-interaction --env=test
run_step "Unit and functional tests" composer tests
run_step "Php Code Sniffer" composer phpcs
run_step "Php Static analysis" composer phpstan
#run_step "Javascript ESLint" npm run lint