-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathMakefile
More file actions
98 lines (85 loc) · 3.22 KB
/
Makefile
File metadata and controls
98 lines (85 loc) · 3.22 KB
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
.DEFAULT_GOAL := help
ifdef NO_DOCKER
PHP = cd app && php
CONSOLE = cd app && php bin/console
else
PHP = ./scripts/php
CONSOLE = ./scripts/console
endif
.PHONY: docker-start
docker-start: .env ## Start the Docker containers (development mode)
docker compose up --build
.PHONY: docker-images
docker-images: ## Rebuild Docker images and pull them from the Docker Hub
docker compose pull --ignore-buildable
docker compose build --pull
.PHONY: docker-clean
docker-clean: ## Delete the Docker containers, volumes and networks (take a FORCE argument)
ifndef FORCE
$(error Please run the operation with FORCE=true)
endif
docker compose down -v
.PHONY: lint
lint: LINTER ?= all
lint: ## Execute the linters (can take a LINTER argument)
ifeq ($(LINTER), $(filter $(LINTER), all phpstan))
$(PHP) vendor/bin/phpstan analyse -v
endif
ifeq ($(LINTER), $(filter $(LINTER), all phpcs))
$(PHP) vendor/bin/phpcs
endif
ifeq ($(LINTER), $(filter $(LINTER), all symfony))
$(CONSOLE) lint:container
endif
.PHONY: lint-fix
lint-fix: LINTER ?= all
lint-fix: ## Fix the errors detected by the linters (can take a LINTER argument)
ifeq ($(LINTER), $(filter $(LINTER), all phpcs))
$(PHP) vendor/bin/phpcbf
endif
.PHONY: migration
migration: ## Generate a database migration from entities changes
$(CONSOLE) make:migration
.PHONY: db-migrate
db-migrate: VERSION ?= latest
db-migrate: ## Migrate the database (can take a VERSION argument)
$(CONSOLE) doctrine:migrations:migrate --no-interaction $(VERSION)
.PHONY: db-rollback
db-rollback: ## Rollback the database to the previous version
$(CONSOLE) doctrine:migrations:migrate --no-interaction prev
.PHONY: db-fixtures
db-fixtures: ## Load the fixtures in the database
$(CONSOLE) doctrine:fixtures:load --append
.PHONY: release
release: ## Release a new version (take a VERSION argument)
ifndef VERSION
$(error You need to provide a "VERSION" argument)
endif
sed -i "s/^VERSION=.*/VERSION=$(VERSION)/" .env.example
$(EDITOR) CHANGELOG.md
git add .
git commit -m "release: Publish version $(VERSION)"
git tag -a $(VERSION) -m "Release version $(VERSION)"
.env:
cp .env.example .env
sed -i "s/^VERSION=.*/VERSION=dev/" .env
sed -i "s/^DB_ROOT_PASSWORD=.*/DB_ROOT_PASSWORD=secret/" .env
sed -i "s/^DB_PASSWORD=.*/DB_PASSWORD=secret/" .env
sed -i "s/^DB_OPENDKIM_PASSWORD=.*/DB_OPENDKIM_PASSWORD=secret/" .env
sed -i "s/^SUPER_ADMIN_PASSWORD=.*/SUPER_ADMIN_PASSWORD=secret/" .env
sed -i "s/^DOMAIN=.*/DOMAIN=localhost/" .env
sed -i "s/^APP_URL=.*/APP_URL=http:\/\/localhost:8090/" .env
sed -i "/SMTP_PORT/s/^#//" .env
sed -i "/SMTP_OUT_PORT/s/^#//" .env
sed -i "s/^SF_APP_ENV=.*/SF_APP_ENV=dev/" .env
sed -i "/^SF_APP_SECRET/s/$$/$(shell openssl rand -hex 16)/" .env
sed -i "/^SF_TOKEN_ENCRYPTION_IV/s/$$/$(shell openssl rand -hex 8)/" .env
sed -i "/^SF_TOKEN_ENCRYPTION_SALT/s/$$/$(shell openssl rand -hex 32)/" .env
sed -i "/COMPOSE_FILE/s/^#//" .env
sed -i "s/.*DB_EXPOSED_PORT.*/DB_EXPOSED_PORT=3307/" .env
sed -i "s/.*UID.*/UID=$(shell id -u)/" .env
sed -i "s/.*GID.*/GID=$(shell id -g)/" .env
sed -i "s/.*MAILPIT_WEB_PORT.*/MAILPIT_WEB_PORT=8025/" .env
.PHONY: help
help:
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'