This repository has been archived by the owner on Sep 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
97 lines (73 loc) · 4.42 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
# Setup ————————————————————————————————————————————————————————————————————————
EXEC_PHP = php
COMPOSER = composer
SYMFONY = $(EXEC_PHP) bin/console
SYMFONY_BIN = symfony
DOCKER = docker
DOCKER_COMP = docker-compose
YARN = yarn
STAN = ./vendor/bin/phpstan
PHP_CS_FIXER = ./vendor/bin/php-cs-fixer
PHPUNIT = ./vendor/bin/phpunit
LE_EXEC = certbot
.DEFAULT_GOAL := help
.PHONY: assets
## —— 🐘 PhpQuiz Make file 🐘 ——————————————————————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
## —— Docker 🐳 ————————————————————————————————————————————————————————————————
up: ## Start the docker hub (Postgres,adminer)
$(DOCKER_COMP) up -d
down: ## Stop the docker hub
$(DOCKER_COMP) down --remove-orphans
wait-postgres: ## Wait for postgresql to be up
bin/wait-for-postgres.sh
## —— Symfony binary 💻 ————————————————————————————————————————————————————————
serve: ## Serve the application with HTTPS support
$(SYMFONY_BIN) serve --daemon --port=8006
unserve: ## Stop the web server
$(SYMFONY_BIN) server:stop
composer-install: composer.lock ## Install vendors according to the current composer.lock file
$(COMPOSER) install
## —— Symfony 🎵 ———————————————————————————————————————————————————————————————
cc: ## Clear cache
$(SYMFONY) c:c
fix-perms: ## Fix permissions of all var files
chmod -R 777 var/*
purge: ## Purge cache and logs
rm -rf var/cache/* var/logs/*
assets: ## Install assets
$(SYMFONY) assets:install public --symlink --relative
load-fixtures: ## Build the db, control the schema validity, load fixtures and check the migration status
$(SYMFONY) doctrine:cache:clear-metadata --flush
$(SYMFONY) doctrine:database:create --if-not-exists
$(SYMFONY) doctrine:schema:drop --force
$(SYMFONY) doctrine:schema:create
$(SYMFONY) doctrine:schema:validate
$(SYMFONY) doctrine:fixtures:load -n
install: composer-install assets dev ## Install all the project dependencies
start: up wait-postgres load-fixtures serve ## Start docker, load fixtures and start the web server
stop: down unserve ## Stop docker and the Symfony binary server
## —— Yarn 🐱 / JavaScript —————————————————————————————————————————————————————
dev: ## Rebuild assets for the dev env
$(YARN) install
$(YARN) run encore dev
watch: ## Watch files and build assets when needed for the dev env
$(YARN) run encore dev --watch
build: ## Build assets for production
$(YARN) run encore production
## —— Coding standards ✨ ——————————————————————————————————————————————————————
fix-php: ## Fix files with php-cs-fixer
@$(PHP_CS_FIXER) fix --allow-risky=yes --config=php-cs-fixer.php
stan: ## Run PHPStan
$(STAN) analyse -c phpstan.neon --memory-limit 1G
cs: stan ## Run all coding standards checks
## —— Tests ✅ —————————————————————————————————————————————————————————————————
test: phpunit.xml.dist ## Run main functional and unit tests
$(eval filter ?= '.')
$(PHPUNIT) --filter=$(filter) --stop-on-failure
## —— Deploy & Prod 🚀 —————————————————————————————————————————————————————————
deploy: ## Full no-downtime deployment with EasyDeploy
$(SYMFONY) deploy -v
le-renew: ## Renew Let's Encrypt HTTPS certificates
$(LE_EXEC) --apache -d phpquiz.xyz -d www.phpquiz.xyz