70 lines
2.6 KiB
Makefile
Raw Normal View History

2020-03-03 17:50:26 +03:00
ROOT_DIR=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
PRESTASHOP_DIR=$(ROOT_DIR)/../PrestaShop
2021-01-21 14:39:32 +03:00
FILE = $(ROOT_DIR)/VERSION
2018-05-28 17:09:31 +03:00
VERSION = `cat $(FILE)`
2018-06-14 13:15:12 +03:00
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip'
2018-05-28 17:09:31 +03:00
2020-03-05 10:41:50 +03:00
.PHONY: build_archive delete_archive
2018-05-28 17:09:31 +03:00
build_archive:
zip -r $(ARCHIVE_NAME) ./retailcrm/*
2018-10-05 17:50:20 +03:00
zip -r /tmp/retailcrm.zip ./retailcrm/*
2018-05-28 17:09:31 +03:00
delete_archive:
rm -f $(ARCHIVE_NAME)
2018-10-05 17:50:20 +03:00
rm -f /tmp/retailcrm.zip
2020-03-03 17:50:26 +03:00
2020-03-04 18:04:06 +03:00
composer: clone_prestashop
2021-01-21 14:39:32 +03:00
cd $(PRESTASHOP_DIR) && git checkout $(BRANCH)
ifeq ($(COMPOSERV1),1)
2021-04-05 13:40:43 +03:00
cd $(PRESTASHOP_DIR) \
&& php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');" \
&& php composer.phar install --prefer-dist --no-interaction --no-progress
2020-03-03 17:50:26 +03:00
else
2021-01-21 14:39:32 +03:00
cd $(PRESTASHOP_DIR)/tests && composer install
2020-03-03 17:50:26 +03:00
endif
clone_prestashop:
2020-03-04 17:01:50 +03:00
cd $(ROOT_DIR)/../ && git clone https://github.com/PrestaShop/PrestaShop
2020-03-03 17:50:26 +03:00
2020-03-04 23:30:02 +03:00
setup_apache:
2020-03-04 17:01:50 +03:00
bash $(PRESTASHOP_DIR)/travis-scripts/setup-php-fpm.sh
echo "* Preparing Apache ..."
sudo a2enmod rewrite actions fastcgi alias
2020-03-03 17:50:26 +03:00
# Use default config
2020-03-04 17:01:50 +03:00
sudo cp -f $(PRESTASHOP_DIR)/tests/travis-ci-apache-vhost /etc/apache2/sites-available/000-default.conf
sudo sed -e "s?%PRESTASHOP_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
sudo chmod 777 -R $(HOME)
2020-03-03 17:50:26 +03:00
# Starting Apache
2020-03-04 17:01:50 +03:00
sudo service apache2 restart
2020-03-03 17:50:26 +03:00
2020-03-04 23:30:02 +03:00
before_script: composer
2021-01-21 14:39:32 +03:00
mkdir coverage
ifeq ($(COMPOSERV1),1)
2021-04-05 13:40:43 +03:00
cd $(PRESTASHOP_DIR) \
&& sed -i 's/mysql -u root/mysql -u root --port $(MYSQL_PORT)/g' travis-scripts/install-prestashop \
&& sed -i 's/--db_server=127.0.0.1 --db_name=prestashop/--db_server=127.0.0.1:$(MYSQL_PORT) --db_name=prestashop --db_user=root/g' travis-scripts/install-prestashop \
&& bash travis-scripts/install-prestashop
2020-03-04 10:21:20 +03:00
else
2021-04-05 13:40:43 +03:00
cd $(PRESTASHOP_DIR) \
&& sed -i 's/mysql -u root/mysql -u root -proot --port $(MYSQL_PORT)/g' travis-scripts/install-prestashop.sh \
&& sed -i 's/--db_server=127.0.0.1 --db_name=prestashop/--db_server=127.0.0.1:$(MYSQL_PORT) --db_name=prestashop --db_user=root/g' travis-scripts/install-prestashop.sh \
&& bash travis-scripts/install-prestashop.sh
2020-03-03 17:50:26 +03:00
endif
2021-11-03 16:19:39 +07:00
lint:
php-cs-fixer fix --config=$(ROOT_DIR)/.php-cs-fixer.php -v
2020-03-03 17:50:26 +03:00
test:
2021-01-21 14:39:32 +03:00
ifeq ($(COMPOSERV1),1)
2021-04-05 13:40:43 +03:00
cd $(PRESTASHOP_DIR) \
&& sed -i 's/throw new Exception/#throw new Exception/g' src/PrestaShopBundle/Install/DatabaseDump.php \
&& php composer.phar run-script create-test-db --timeout=0
2020-03-04 17:01:50 +03:00
cd $(PRESTASHOP_DIR) && php vendor/bin/phpunit -c $(ROOT_DIR)/phpunit.xml.dist
2021-01-21 14:39:32 +03:00
else
phpunit -c phpunit.xml.dist
endif
coverage:
wget https://phar.phpunit.de/phpcov-2.0.2.phar && php phpcov-2.0.2.phar merge coverage/ --clover coverage.xml