forked from shopware5/shopware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (75 loc) · 4.18 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
ifeq ($(origin ENV_FILE), undefined)
ENV_FILE:=.env
endif
-include $(ENV_FILE)
.PHONY: init clear-cache check-code test-mink elasticsearch-populate test-phpunit test-phpunit-elasticsearch debug-config clean-make-config clean check-config-variables
init: .make.init
clear-cache: .make.console.executable
./bin/console sw:cache:clear
check-code: check-phpstan check-php-cs-fixer
check-php-cs-fixer:
./vendor/bin/php-cs-fixer fix --dry-run -v --allow-risky=yes --format=junit | tee php-cs-fixer.xml
fix-code-style:
php -d memory_limit=-1 ./vendor/bin/php-cs-fixer fix --allow-risky=yes -v
check-phpstan:
php -d memory_limit=4G ./vendor/bin/phpstan analyze -c .phpstan.neon --no-progress --error-format=table
prepare-mink: .make.config.build.mink
./bin/console sw:rebuild:seo:index
./bin/console sw:theme:cache:generate
./bin/console dbal:run-sql 'UPDATE s_core_config_elements SET value = "b:0;" WHERE name = "show_cookie_note"'
./bin/console sw:cache:clear
test-mink: init .make.config.build.mink
./vendor/bin/behat -vv --config=tests/Mink/behat.yml --format=pretty --out=std --format=junit --out=build/artifacts
test-phpunit: init
./vendor/bin/phpunit --config tests/phpunit_unit.xml.dist --log-junit build/artifacts/test-log.xml
./vendor/bin/phpunit --config tests/phpunit.xml.dist --log-junit build/artifacts/test-log.xml --exclude-group=elasticSearch
test-phpunit-elasticsearch: elasticsearch-populate
./vendor/bin/phpunit --config tests/phpunit.xml.dist --log-junit build/artifacts/test-log.xml --exclude-group=skipElasticSearch --group=elasticSearch
elasticsearch-populate: .make.config.build.elasticsearch .make.console.executable
./bin/console sw:es:index:populate
./bin/console sw:es:backend:index:populate
debug-config: clean-make-config .make.config.build.debug
@echo "Debug configuration file generated"
config: clean-make-config .make.config
@echo "Default configuration file generated"
check-config-variables:
@if [ -z "$(DB_USER)" ]; then echo "No or invalid database user supplied"; exit 1; fi
@if [ -z "$(DB_PORT)" ]; then echo "No or invalid database port supplied"; exit 1; fi
@if [ -z "$(DB_NAME)" ]; then echo "No or invalid database name supplied"; exit 1; fi
@if [ -z "$(DB_HOST)" ]; then echo "No or invalid database host supplied"; exit 1; fi
@if [ -z "$(DB_PASSWORD)" ]; then echo "No or invalid database password supplied"; exit 1; fi
clean-make-config:
rm .make.config.* 2> /dev/null || true
clean:
rm .make.* 2> /dev/null || true
debug-config-test: .make.config.build.debug
.make.config: check-config-variables .make.config.behat
@sed -e 's/%db\.user%/$(DB_USER)/g' -e 's/%db\.password%/$(DB_PASSWORD)/g' -e 's/%db\.database%/$(DB_NAME)/g' -e 's/%db\.host%/$(DB_HOST)/g' -e 's/%db\.port%/$(DB_PORT)/g' -e 's/%db\.port%/$(DB_PORT)/g' -e 's/%elasticsearch\.host%/$(ELASTICSEARCH_HOST)/g' < ./config.php.dist > ./config.php
touch $@
.make.config.build.%: check-config-variables .make.config.behat
@sed -e 's/%db\.user%/$(DB_USER)/g' -e 's/%db\.password%/$(DB_PASSWORD)/g' -e 's/%db\.database%/$(DB_NAME)/g' -e 's/%db\.host%/$(DB_HOST)/g' -e 's/%db\.port%/$(DB_PORT)/g' -e 's/%db\.port%/$(DB_PORT)/g' -e 's/%elasticsearch\.host%/$(ELASTICSEARCH_HOST)/g' < ./build/config-$*.php > ./config.php
touch $@
.make.config.behat:
@sed -e 's/%sw\.host%/$(SW_HOST)/g' -e 's|%sw\.path%|$(SW_BASE_PATH)|g' < ./build/behat.yml.dist > ./tests/Mink/behat.yml
touch $@
.make.install:
@echo "Read additional variables from $(ENV_FILE)"
composer install
./bin/console sw:database:setup --steps=drop,create,import,importDemodata
./bin/console sw:cache:clear
./bin/console sw:database:setup --steps=setupShop --shop-url=http://$(SW_HOST)$(SW_BASE_PATH)
./bin/console sw:snippets:to:db --include-plugins
./bin/console sw:theme:initialize
./bin/console sw:firstrunwizard:disable
./bin/console sw:admin:create --name="Demo" --email="[email protected]" --username="demo" --password="demo" --locale=de_DE -n
touch recovery/install/data/install.lock
.make.init: clean-make-config .make.config .make.install
.make.console.executable:
chmod u+x bin/console
touch $@