|
| 1 | +ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST)))) |
| 2 | +include $(ROOT_DIR)/tools/make/text.mk |
| 3 | +include $(ROOT_DIR)/tools/make/help.mk |
| 4 | +include $(ROOT_DIR)/tools/make/os.mk |
| 5 | +include $(ROOT_DIR)/tools/make/git.mk |
| 6 | + |
| 7 | +.DEFAULT_GOAL := help |
| 8 | + |
| 9 | +# Executables |
| 10 | +SF := symfony |
| 11 | +SF_PROXY = $(shell $(SF) local:proxy:url) |
| 12 | +SF_CONSOLE := $(SF) console |
| 13 | +PHP := $(SF) php |
| 14 | +COMPOSER := $(SF) composer |
| 15 | + |
| 16 | +UID := $(shell id -u) |
| 17 | +GID := $(shell id -g) |
| 18 | +DC := USER_ID=$(UID) GROUP_ID=$(GID) docker compose --env-file /dev/null |
| 19 | + |
| 20 | +## Install everything needed to start the project |
| 21 | +install: |
| 22 | + $(SF) local:server:ca:install |
| 23 | + $(MAKE) start |
| 24 | + $(MAKE) app.install |
| 25 | + |
| 26 | +## Start the environment |
| 27 | +start: |
| 28 | + $(DC) up -d |
| 29 | + $(SF) proxy:start |
| 30 | + $(SF) serve |
| 31 | + |
| 32 | +## Stop the environment |
| 33 | +stop: |
| 34 | + $(DC) kill |
| 35 | + |
| 36 | +## Stop and delete the environment and project data (database, logs, etc.) |
| 37 | +delete: |
| 38 | + $(DC) down -v --remove-orphans |
| 39 | + |
| 40 | +## App - Install the application |
| 41 | +app.install: |
| 42 | + @$(call action, Installing PHP dependencies...) |
| 43 | + $(COMPOSER) install --prefer-dist |
| 44 | + |
| 45 | + @$(call action, Running DB migrations...) |
| 46 | + $(SF_CONSOLE) doctrine:migrations:migrate --no-interaction --all-or-nothing |
| 47 | + |
| 48 | +## App - Install the application (alias to "make app.install") |
| 49 | +app.update: app.install |
| 50 | + |
| 51 | +###### |
| 52 | +# QA # |
| 53 | +###### |
| 54 | + |
| 55 | +## QA - Run all QA checks |
| 56 | +qa: archi refactor cs lint phpstan test |
| 57 | + |
| 58 | +## QA - Run all QA checks and fix issues |
| 59 | +qa.fix: archi refactor.fix cs.fix lint.fix phpstan test |
| 60 | + |
| 61 | +######### |
| 62 | +# Archi # |
| 63 | +######### |
| 64 | + |
| 65 | +## Architecture - Run architecture checks |
| 66 | +archi: archi.back |
| 67 | + |
| 68 | +## Architecture - Run architecture checks for backend |
| 69 | +archi.back: |
| 70 | + $(PHP) vendor/bin/deptrac --report-uncovered --fail-on-uncovered |
| 71 | + |
| 72 | +############ |
| 73 | +# Refactor # |
| 74 | +############ |
| 75 | + |
| 76 | +## Refactor - Run all refactor checks |
| 77 | +refactor: refactor.back |
| 78 | + |
| 79 | +## Refactor - Run all refactor checks and fix issues |
| 80 | +refactor.fix: refactor.back.fix |
| 81 | + |
| 82 | +## Refactor - Run refactor checks for backend |
| 83 | +refactor.back: |
| 84 | + $(PHP) vendor/bin/rector process --dry-run |
| 85 | + |
| 86 | +## Refactor - Run refactor checks for backend and fix issues |
| 87 | +refactor.back.fix: |
| 88 | + $(PHP) vendor/bin/rector process |
| 89 | + |
| 90 | +################ |
| 91 | +# Coding style # |
| 92 | +################ |
| 93 | + |
| 94 | +## Coding style - Run all coding style checks |
| 95 | +cs: cs.back cs.front |
| 96 | + |
| 97 | +## Coding style - Run all coding style checks and fix issues |
| 98 | +cs.fix: cs.back.fix cs.front.fix |
| 99 | + |
| 100 | +## Coding style - Check backend coding style |
| 101 | +cs.back: |
| 102 | + $(PHP) vendor/bin/ecs check |
| 103 | + $(PHP) vendor/bin/twig-cs-fixer |
| 104 | + |
| 105 | +## Coding style - Check backend coding style and fix issues |
| 106 | +cs.back.fix: |
| 107 | + $(PHP) vendor/bin/ecs check --fix |
| 108 | + $(PHP) vendor/bin/twig-cs-fixer --fix |
| 109 | + |
| 110 | +## Coding style - Check frontend coding style |
| 111 | +cs.front: bin/oxfmt |
| 112 | + bin/oxfmt --check |
| 113 | + |
| 114 | +## Coding style - Check frontend coding style and fix issues |
| 115 | +cs.front.fix: bin/oxfmt |
| 116 | + bin/oxfmt |
| 117 | + |
| 118 | +bin/oxfmt: |
| 119 | + @$(call action, Downloading oxfmt...) |
| 120 | + $(SF_CONSOLE) oxc:download:oxfmt |
| 121 | + @$(call success, oxfmt downloaded successfully) |
| 122 | + |
| 123 | +########## |
| 124 | +# Linter # |
| 125 | +########## |
| 126 | + |
| 127 | +## Linter - Run all linters |
| 128 | +lint: lint.back lint.front |
| 129 | + |
| 130 | +## Linter - Run all linters and fix issues |
| 131 | +lint.fix: lint.back lint.front.fix |
| 132 | + |
| 133 | +## Linter - Run linters for backend |
| 134 | +lint.back: |
| 135 | + $(SF_CONSOLE) lint:container |
| 136 | + $(SF_CONSOLE) lint:xliff translations |
| 137 | + $(SF_CONSOLE) lint:yaml --parse-tags config |
| 138 | + $(SF_CONSOLE) lint:twig templates |
| 139 | + #$(SF_CONSOLE) doctrine:schema:validate |
| 140 | + |
| 141 | +## Linter - Lint front files |
| 142 | +lint.front: bin/oxlint |
| 143 | + bin/oxlint |
| 144 | + |
| 145 | +## Linter - Lint front files and fix issues |
| 146 | +lint.front.fix: bin/oxlint |
| 147 | + bin/oxlint --fix |
| 148 | + |
| 149 | +bin/oxlint: |
| 150 | + @$(call action, Downloading oxlint...) |
| 151 | + $(SF_CONSOLE) oxc:download:oxlint |
| 152 | + |
| 153 | +########### |
| 154 | +# PHPStan # |
| 155 | +########### |
| 156 | + |
| 157 | +## PHPStan - Run PHPStan |
| 158 | +phpstan: |
| 159 | + $(PHP) vendor/bin/phpstan analyse |
| 160 | + |
| 161 | +## PHPStan - Run PHPStan and update the baseline |
| 162 | +phpstan.generate-baseline: |
| 163 | + $(PHP) vendor/bin/phpstan analyse --generate-baseline |
| 164 | + |
| 165 | +######### |
| 166 | +# Tests # |
| 167 | +######### |
| 168 | + |
| 169 | +## Tests - Run all tests |
| 170 | +test: test.back |
| 171 | + |
| 172 | +## Tests - Run backend tests |
| 173 | +test.back: |
| 174 | + $(PHP) vendor/bin/phpunit |
| 175 | +## Tests - Run backend tests with coverage |
| 176 | + |
| 177 | +test.back.coverage: |
| 178 | + $(PHP) vendor/bin/phpunit --coverage-html .cache/phpunit/coverage-html |
| 179 | + |
| 180 | +-include $(ROOT_DIR)/Makefile.local |
0 commit comments