-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
121 lines (100 loc) · 2.83 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
.DEFAULT_GOAL := help
USER = $(shell id -u):$(shell id -g)
DOCKER_COMPOSE = docker compose -p flus -f docker/docker-compose.yml
ifdef NO_DOCKER
PHP = php
COMPOSER = composer
NPM = npm
CLI = php cli
else
PHP = ./docker/bin/php
COMPOSER = ./docker/bin/composer
NPM = ./docker/bin/npm
CLI = ./docker/bin/cli
endif
ifndef COVERAGE
COVERAGE = --coverage-html ./coverage
endif
ifdef FILTER
PHPUNIT_FILTER = --filter=$(FILTER)
else
PHPUNIT_FILTER =
endif
ifdef FILE
PHPUNIT_FILE = $(FILE)
else
PHPUNIT_FILE = ./tests
endif
.PHONY: docker-start
docker-start: .env ## Start a development server with Docker
@echo "Running webserver on http://localhost:8000"
$(DOCKER_COMPOSE) up
.PHONY: docker-clean
docker-clean: ## Stop and clean Docker server
$(DOCKER_COMPOSE) down
.PHONY: docker-build
docker-build: ## Rebuild the Docker images
$(DOCKER_COMPOSE) build
.PHONY: install
install: ## Install the dependencies
$(COMPOSER) install
$(NPM) install
.PHONY: setup
setup: .env ## Setup the application system
$(CLI) migrations setup --seed
.PHONY: rollback
rollback: ## Reverse the last migration
ifdef STEPS
$(CLI) migrations rollback --steps=$(STEPS)
else
$(CLI) migrations rollback
endif
.PHONY: reset
reset: ## Reset the database
ifndef FORCE
$(error Please run the operation with FORCE=true)
endif
$(DOCKER_COMPOSE) stop job_worker
$(CLI) migrations reset --force --seed
$(DOCKER_COMPOSE) start job_worker
.PHONY: icons-build
icons-build: ## Build the icons asset
$(NPM) run build:icons
.PHONY: test
test: ## Run the test suite
$(PHP) ./vendor/bin/phpunit \
-c .phpunit.xml \
$(COVERAGE) \
$(PHPUNIT_FILTER) \
$(PHPUNIT_FILE)
.PHONY: lint
lint: ## Run the linters on the PHP and JS files
$(PHP) ./vendor/bin/phpstan analyse --memory-limit 1G -c phpstan.neon
$(PHP) ./vendor/bin/phpcs --extensions=php --ignore=./src/views/ --standard=PSR12 ./src ./tests ./lib/SpiderBits
$(NPM) run lint-js
$(NPM) run lint-css
.PHONY: lint-fix
lint-fix: ## Fix the errors detected by the linters
$(PHP) ./vendor/bin/phpcbf --extensions=php --ignore=./src/views/ --standard=PSR12 ./src ./tests ./lib/SpiderBits
$(NPM) run lint-js-fix
$(NPM) run lint-css-fix
.PHONY: release
release: ## Release a new version (take a VERSION argument)
ifndef VERSION
$(error You need to provide a "VERSION" argument)
endif
echo $(VERSION) > VERSION.txt
rm -rf public/assets/*
$(NPM) run build
$(EDITOR) CHANGELOG.md
git add .
git commit -m "release: Publish version v$(VERSION)"
git tag -a v$(VERSION) -m "Release version v$(VERSION)"
.PHONY: tree
tree: ## Display the structure of the application
tree -I 'Minz|vendor|node_modules|coverage|cache|dev_assets|media' --dirsfirst -CA
.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}'
.env:
@cp env.sample .env