import files
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
##
|
||||
# CACHE
|
||||
|
||||
## Clear symfony cache
|
||||
.PHONY: cache-clear
|
||||
cache-clear: cache-clear-dev cache-clear-prod
|
||||
|
||||
.PHONY: cache-clear-%
|
||||
cache-clear-%: bootstrap ## Clear symfony cache
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console cache:clear --env=$*)
|
||||
|
||||
.PHONY: cache-rm
|
||||
cache-rm: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -Rf app/cache/* app/logs/*)
|
||||
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown www-data app/cache/ app/logs/))
|
||||
|
||||
.PHONY: cache-warmup
|
||||
cache-warmup: cache-warmup-$(SYMFONY_ENV)
|
||||
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown -R www-data app/cache/ app/logs/))
|
||||
|
||||
.PHONY: cache-warmup-%
|
||||
cache-warmup-%: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console cache:warmup --env=$*)
|
||||
@@ -0,0 +1,12 @@
|
||||
##
|
||||
# CLEAN
|
||||
|
||||
.PHONY: clean-php-app
|
||||
clean-php-app: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/bootstrap.php.cache)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/cache/* app/cach~)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf app/logs/*)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf var/cache/* var/cach~)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf var/logs/*)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf vendor/*)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),rm -rf node_modules/*)
|
||||
@@ -0,0 +1,24 @@
|
||||
COMPOSER_ARGS ?= --optimize-autoloader
|
||||
COMPOSER_MEMORY_LIMIT ?= -1
|
||||
CONTEXT += COMPOSER_ARGS
|
||||
|
||||
ifeq ($(SYMFONY_ENV), prod)
|
||||
COMPOSER_ARGS += --classmap-authoritative --prefer-dist --no-dev --no-interaction
|
||||
endif
|
||||
ifeq ($(DRONE), true)
|
||||
COMPOSER_ARGS += --no-progress
|
||||
endif
|
||||
|
||||
define composer
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),COMPOSER_MEMORY_LIMIT=$(COMPOSER_MEMORY_LIMIT) SYMFONY_ENV=$(SYMFONY_ENV) composer $(1) $(COMPOSER_ARGS))
|
||||
endef
|
||||
|
||||
define composer-require-vendor-binary
|
||||
$(eval vendor:=$(1))
|
||||
$(eval binary:=$(or $(2),$(lastword $(subst /, ,$(vendor)))))
|
||||
$(eval version:=$(or $(addprefix :,$(3)),$(shell awk '/'$(subst /,\\/,$(vendor))'/ {gsub("[\",]","",$$2); print ":"$$2}' composer.json 2>/dev/null)))
|
||||
$(eval DRYRUN_IGNORE := true)
|
||||
$(eval COMPOSER_REQUIRE := $(shell $(call docker-compose-exec,$(DOCKER_SERVICE),[ -f vendor/$(vendor)/$(binary) ] || echo true)))
|
||||
$(eval DRYRUN_IGNORE := false)
|
||||
$(if $(COMPOSER_REQUIRE),$(call docker-compose-exec,$(DOCKER_SERVICE),mkdir -p vendor/$(vendor) && cd /tmp && COMPOSER_MEMORY_LIMIT=$(COMPOSER_MEMORY_LIMIT) SYMFONY_ENV=$(SYMFONY_ENV) composer require "$(vendor)$(version)" --prefer-source --no-interaction --dev && cd - && ln -s /tmp/vendor/$(vendor)/$(binary) vendor/$(vendor)/$(binary)))
|
||||
endef
|
||||
@@ -0,0 +1,8 @@
|
||||
BUILD_APP_VARS += SYMFONY_ENV
|
||||
DOCKER_SERVICE ?= php
|
||||
|
||||
ifneq (,$(filter $(ENV),$(ENV_DEPLOY)))
|
||||
SYMFONY_ENV ?= prod
|
||||
else
|
||||
SYMFONY_ENV ?= dev
|
||||
endif
|
||||
@@ -0,0 +1,10 @@
|
||||
##
|
||||
# DEV
|
||||
|
||||
.PHONY: dev-phpcs
|
||||
dev-phpcs: bootstrap install-phpcs
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpcs --standard=PSR2 --colors -p ./src)
|
||||
|
||||
.PHONY: dev-phpcbf
|
||||
dev-phpcbf: bootstrap install-phpcbf
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpcbf ./src/ --ignore=*.js)
|
||||
@@ -0,0 +1,43 @@
|
||||
##
|
||||
# INSTALL
|
||||
|
||||
.PHONY: install-assets
|
||||
install-assets: install-assets-$(SYMFONY_ENV)
|
||||
|
||||
.PHONY: install-assets-%
|
||||
install-assets-%: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console assetic:dump --env=$*)
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console assets:install --env=$*)
|
||||
$(if $(filter $(ENV),$(ENV_DEPLOY)),$(call docker-compose-exec,$(DOCKER_SERVICE),chown -R www-data web/bundles/ web/css/ web/js/))
|
||||
|
||||
.PHONY: install-codecept
|
||||
install-codecept: bootstrap install-phpunit vendor/codeception/codeception/codecept
|
||||
|
||||
vendor/codeception/codeception/codecept:
|
||||
$(call composer-require-vendor-binary,codeception/codeception,codecept)
|
||||
|
||||
.PHONY: install-composer
|
||||
install-composer: bootstrap
|
||||
$(call composer,install)
|
||||
|
||||
.PHONY: install-doctrine-schema-update
|
||||
install-doctrine-schema-update: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),php app/console doctrine:schema:update --force)
|
||||
|
||||
.PHONY: install-phpcbf
|
||||
install-phpcbf: bootstrap vendor/squizlabs/php_codesniffer/bin/phpcbf
|
||||
|
||||
vendor/squizlabs/php_codesniffer/bin/phpcbf:
|
||||
$(call composer-require-vendor-binary,squizlabs/php_codesniffer,bin/phpcbf)
|
||||
|
||||
.PHONY: install-phpcs
|
||||
install-phpcs: bootstrap vendor/squizlabs/php_codesniffer/bin/phpcs
|
||||
|
||||
vendor/squizlabs/php_codesniffer/bin/phpcs:
|
||||
$(call composer-require-vendor-binary,squizlabs/php_codesniffer,bin/phpcs)
|
||||
|
||||
.PHONY: install-phpunit
|
||||
install-phpunit: bootstrap vendor/phpunit/phpunit/phpunit
|
||||
|
||||
vendor/phpunit/phpunit/phpunit:
|
||||
$(call composer-require-vendor-binary,phpunit/phpunit)
|
||||
@@ -0,0 +1,52 @@
|
||||
##
|
||||
# TEST
|
||||
|
||||
## Run unit tests
|
||||
.PHONY: test
|
||||
test: test-unit ## Run unit tests
|
||||
|
||||
## Run codeception tests
|
||||
.PHONY: test-codeception-%
|
||||
test-codeception-%: bootstrap install-codecept ## Run codeception tests
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/codecept run $*)
|
||||
|
||||
## Run old unit tests with code coverage
|
||||
.PHONY: test-coverage
|
||||
test-coverage: bootstrap install-phpunit ## Run code coverage
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite unit --coverage-text)
|
||||
|
||||
## Run codeception tests with coverage
|
||||
.PHONY: test-coverage-codeception-%
|
||||
test-coverage-codeception-%: bootstrap install-codecept ## Run codeception tests with coverage
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/codecept run $* --coverage --coverage-html)
|
||||
|
||||
## Run phpunit functional tests
|
||||
.PHONY: test-func
|
||||
test-func: bootstrap install-phpunit ## Run functional tests
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite functional)
|
||||
|
||||
## Loop unit tests
|
||||
.PHONY: test-loop
|
||||
test-loop: bootstrap install-phpunit ## Loop unit tests
|
||||
while true; \
|
||||
do $(MAKE) test; \
|
||||
read continue; \
|
||||
done;
|
||||
|
||||
## Run search tests
|
||||
.PHONY: test-search
|
||||
test-search: bootstrap install-phpunit ## Run search tests
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite search)
|
||||
|
||||
.PHONY: test-templates
|
||||
test-templates: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),php app/console lint:twig @UIBundle)
|
||||
|
||||
## Run old unit tests
|
||||
.PHONY: test-unit
|
||||
test-unit: bootstrap install-phpunit ## Run unit tests
|
||||
ifdef FILTER
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite unit --filter $(FILTER))
|
||||
else
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),bin/phpunit --testsuite unit)
|
||||
endif
|
||||
@@ -0,0 +1,6 @@
|
||||
##
|
||||
# UPDATE
|
||||
|
||||
.PHONY: update-database
|
||||
update-database: bootstrap
|
||||
$(call docker-compose-exec,$(DOCKER_SERVICE),app/console --no-interaction doctrine:migration:migrate)
|
||||
Reference in New Issue
Block a user