5
5
# https://docs.docker.com/compose/environment-variables/envvars/
6
6
export DOCKER_BUILDKIT ?= 1
7
7
8
+ # Docker binary to use, when executing docker tasks
9
+ DOCKER ?= docker
10
+
8
11
# Binary to use, when executing docker-compose tasks
9
12
DOCKER_COMPOSE ?= docker compose
10
13
@@ -25,13 +28,27 @@ BUILDER_WIRED ?= $(BUILDER_PARAMS) --network project.$(COMPOSE_PROJECT_NAME) $(S
25
28
# Shorthand envsubst command, executed through build-deps
26
29
ENVSUBST ?= $(BUILDER ) envsubst
27
30
28
- EXPORT_VARS = '\
29
- $${COMPOSE_PROJECT_NAME} \
30
- $${COMPOSER_AUTH}'
31
+ # Yamllint docker image
32
+ YAML_LINT_RUNNER ?= $(DOCKER ) run --rm $$(tty -s && echo "-it" || echo ) \
33
+ -v $(PWD ) :/data \
34
+ cytopia/yamllint:latest \
35
+ -f colored .
36
+
37
+ ACTION_LINT_RUNNER ?= $(DOCKER ) run --rm $$(tty -s && echo "-it" || echo ) \
38
+ -v $(shell pwd) :/repo \
39
+ --workdir /repo \
40
+ rhysd/actionlint:latest \
41
+ -color
42
+
43
+ PHIVE_RUNNER ?= $(DOCKER_COMPOSE ) run --rm --no-deps app
31
44
32
45
NPM_RUNNER ?= pnpm
33
46
47
+ EXPORT_VARS = '\
48
+ $${COMPOSE_PROJECT_NAME} \
49
+ $${COMPOSER_AUTH}'
34
50
51
+ #
35
52
# Self documenting Makefile code
36
53
# ------------------------------------------------------------------------------------
37
54
ifneq ($(TERM ) ,)
@@ -71,17 +88,19 @@ help:
71
88
@echo ' 📦 Package laravel-cycle-orm-adapter (github.com/wayofdev/laravel-cycle-orm-adapter)'
72
89
@echo ' 🤠 Author Andrij Orlenko (github.com/lotyp)'
73
90
@echo ' 🏢 ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}'
91
+ @echo
74
92
.PHONY : help
75
93
76
94
.EXPORT_ALL_VARIABLES :
77
95
96
+ #
78
97
# Default action
79
98
# Defines default command when `make` is executed without additional parameters
80
99
# ------------------------------------------------------------------------------------
81
- all : install hooks
100
+ all : env prepare install hooks phive up
82
101
.PHONY : all
83
102
84
-
103
+ #
85
104
# System Actions
86
105
# ------------------------------------------------------------------------------------
87
106
env : # # Generate .env file from example, use `make env force=true`, to force re-create file
@@ -101,7 +120,7 @@ prepare:
101
120
mkdir -p .build/php-cs-fixer
102
121
.PHONY : prepare
103
122
104
-
123
+ #
105
124
# Docker Actions
106
125
# ------------------------------------------------------------------------------------
107
126
up : # Creates and starts containers, defined in docker-compose and override file
@@ -135,7 +154,7 @@ ssh: ## Login inside running docker container
135
154
$(APP_RUNNER ) sh
136
155
.PHONY : ssh
137
156
138
-
157
+ #
139
158
# Composer
140
159
# ------------------------------------------------------------------------------------
141
160
install : # # Installs composer dependencies
@@ -146,21 +165,30 @@ update: ## Updates composer dependencies by running composer update command
146
165
$(APP_COMPOSER ) update
147
166
.PHONY : update
148
167
168
+ phive : # # Installs dependencies with phive
169
+ $(APP_RUNNER ) /usr/local/bin/phive install --trust-gpg-keys 0x033E5F8D801A2F8D
170
+ .PHONY : phive
149
171
150
- # Code Quality, Git, Linting, Testing
172
+ #
173
+ # Code Quality, Git, Linting
151
174
# ------------------------------------------------------------------------------------
152
175
hooks : # # Install git hooks from pre-commit-config
153
176
pre-commit install
177
+ pre-commit install --hook-type commit-msg
154
178
pre-commit autoupdate
155
179
.PHONY : hooks
156
180
157
- lint : lint-yaml lint-php lint-stan # # Runs all linting commands
181
+ lint : lint-yaml lint-actions lint- php lint-stan lint-composer lint-audit # # Runs all linting commands
158
182
.PHONY : lint
159
183
160
184
lint-yaml : # # Lints yaml files inside project
161
- yamllint .
185
+ @ $( YAML_LINT_RUNNER ) | tee -a $( MAKE_LOGFILE )
162
186
.PHONY : lint-yaml
163
187
188
+ lint-actions : # # Lint all github actions
189
+ @$(ACTION_LINT_RUNNER ) | tee -a $(MAKE_LOGFILE )
190
+ .PHONY : lint-actions
191
+
164
192
lint-php : prepare # # Fixes code to follow coding standards using php-cs-fixer
165
193
$(APP_COMPOSER ) cs:fix
166
194
.PHONY : lint-php
@@ -177,6 +205,51 @@ lint-stan-ci:
177
205
$(APP_COMPOSER ) stan:ci
178
206
.PHONY : lint-stan-ci
179
207
208
+ lint-stan-baseline : # # Runs phpstan to update its baseline
209
+ $(APP_COMPOSER ) stan:baseline
210
+ .PHONY : lint-stan-baseline
211
+
212
+ lint-psalm : # # Runs vimeo/psalm – static analysis tool
213
+ $(APP_COMPOSER ) psalm
214
+ .PHONY : lint-psalm
215
+
216
+ lint-psalm-ci : # # Runs vimeo/psalm – static analysis tool with github output (CI mode)
217
+ $(APP_COMPOSER ) psalm:ci
218
+ .PHONY : lint-psalm-ci
219
+
220
+ lint-psalm-baseline : # # Runs vimeo/psalm to update its baseline
221
+ $(APP_COMPOSER ) psalm:baseline
222
+ .PHONY : lint-psalm-baseline
223
+
224
+ lint-deps : # # Runs composer-require-checker – checks for dependencies that are not used
225
+ $(APP_RUNNER ) .phive/composer-require-checker check \
226
+ --config-file=/app/composer-require-checker.json \
227
+ --verbose
228
+ .PHONY : lint-deps
229
+
230
+ lint-composer : # # Normalize composer.json and composer.lock files
231
+ $(APP_COMPOSER ) normalize
232
+ .PHONY : lint-composer
233
+
234
+ lint-audit : # # Runs security checks for composer dependencies
235
+ $(APP_COMPOSER ) audit
236
+ .PHONY : lint-security
237
+
238
+ refactor : # # Runs rector – code refactoring tool
239
+ $(APP_COMPOSER ) refactor
240
+ .PHONY : refactor
241
+
242
+ #
243
+ # Testing
244
+ # ------------------------------------------------------------------------------------
245
+ infect : # # Runs mutation tests with infection/infection
246
+ $(APP_COMPOSER ) infect
247
+ .PHONY : infect
248
+
249
+ infect-ci : # # Runs infection – mutation testing framework with github output (CI mode)
250
+ $(APP_COMPOSER ) infect:ci
251
+ .PHONY : lint-infect-ci
252
+
180
253
test : # # Run project php-unit and pest tests
181
254
$(APP_COMPOSER ) test
182
255
.PHONY : test
@@ -185,6 +258,14 @@ test-cc: ## Run project php-unit and pest tests in coverage mode and build repor
185
258
$(APP_COMPOSER ) test:cc
186
259
.PHONY : test-cc
187
260
261
+ #
262
+ # Release
263
+ # ------------------------------------------------------------------------------------
264
+ commit :
265
+ czg commit --config=" ./.github/.cz.config.js"
266
+ .PHONY : commit
267
+
268
+ #
188
269
# Documentation
189
270
# ------------------------------------------------------------------------------------
190
271
docs-deps-update : # # Check for outdated dependencies and automatically update them using pnpm
0 commit comments