55# https://docs.docker.com/compose/environment-variables/envvars/
66export DOCKER_BUILDKIT ?= 1
77
8+ # Docker binary to use, when executing docker tasks
9+ DOCKER ?= docker
10+
811# Binary to use, when executing docker-compose tasks
912DOCKER_COMPOSE ?= docker compose
1013
@@ -25,13 +28,27 @@ BUILDER_WIRED ?= $(BUILDER_PARAMS) --network project.$(COMPOSE_PROJECT_NAME) $(S
2528# Shorthand envsubst command, executed through build-deps
2629ENVSUBST ?= $(BUILDER ) envsubst
2730
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
3144
3245NPM_RUNNER ?= pnpm
3346
47+ EXPORT_VARS = '\
48+ $${COMPOSE_PROJECT_NAME} \
49+ $${COMPOSER_AUTH}'
3450
51+ #
3552# Self documenting Makefile code
3653# ------------------------------------------------------------------------------------
3754ifneq ($(TERM ) ,)
@@ -71,17 +88,19 @@ help:
7188 @echo ' 📦 Package laravel-cycle-orm-adapter (github.com/wayofdev/laravel-cycle-orm-adapter)'
7289 @echo ' 🤠 Author Andrij Orlenko (github.com/lotyp)'
7390 @echo ' 🏢 ${YELLOW}Org wayofdev (github.com/wayofdev)${RST}'
91+ @echo
7492.PHONY : help
7593
7694.EXPORT_ALL_VARIABLES :
7795
96+ #
7897# Default action
7998# Defines default command when `make` is executed without additional parameters
8099# ------------------------------------------------------------------------------------
81- all : install hooks
100+ all : env prepare install hooks phive up
82101.PHONY : all
83102
84-
103+ #
85104# System Actions
86105# ------------------------------------------------------------------------------------
87106env : # # Generate .env file from example, use `make env force=true`, to force re-create file
@@ -101,7 +120,7 @@ prepare:
101120 mkdir -p .build/php-cs-fixer
102121.PHONY : prepare
103122
104-
123+ #
105124# Docker Actions
106125# ------------------------------------------------------------------------------------
107126up : # Creates and starts containers, defined in docker-compose and override file
@@ -135,7 +154,7 @@ ssh: ## Login inside running docker container
135154 $(APP_RUNNER ) sh
136155.PHONY : ssh
137156
138-
157+ #
139158# Composer
140159# ------------------------------------------------------------------------------------
141160install : # # Installs composer dependencies
@@ -146,21 +165,30 @@ update: ## Updates composer dependencies by running composer update command
146165 $(APP_COMPOSER ) update
147166.PHONY : update
148167
168+ phive : # # Installs dependencies with phive
169+ $(APP_RUNNER ) /usr/local/bin/phive install --trust-gpg-keys 0x033E5F8D801A2F8D
170+ .PHONY : phive
149171
150- # Code Quality, Git, Linting, Testing
172+ #
173+ # Code Quality, Git, Linting
151174# ------------------------------------------------------------------------------------
152175hooks : # # Install git hooks from pre-commit-config
153176 pre-commit install
177+ pre-commit install --hook-type commit-msg
154178 pre-commit autoupdate
155179.PHONY : hooks
156180
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
158182.PHONY : lint
159183
160184lint-yaml : # # Lints yaml files inside project
161- yamllint .
185+ @ $( YAML_LINT_RUNNER ) | tee -a $( MAKE_LOGFILE )
162186.PHONY : lint-yaml
163187
188+ lint-actions : # # Lint all github actions
189+ @$(ACTION_LINT_RUNNER ) | tee -a $(MAKE_LOGFILE )
190+ .PHONY : lint-actions
191+
164192lint-php : prepare # # Fixes code to follow coding standards using php-cs-fixer
165193 $(APP_COMPOSER ) cs:fix
166194.PHONY : lint-php
@@ -177,6 +205,51 @@ lint-stan-ci:
177205 $(APP_COMPOSER ) stan:ci
178206.PHONY : lint-stan-ci
179207
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+
180253test : # # Run project php-unit and pest tests
181254 $(APP_COMPOSER ) test
182255.PHONY : test
@@ -185,6 +258,14 @@ test-cc: ## Run project php-unit and pest tests in coverage mode and build repor
185258 $(APP_COMPOSER ) test:cc
186259.PHONY : test-cc
187260
261+ #
262+ # Release
263+ # ------------------------------------------------------------------------------------
264+ commit :
265+ czg commit --config=" ./.github/.cz.config.js"
266+ .PHONY : commit
267+
268+ #
188269# Documentation
189270# ------------------------------------------------------------------------------------
190271docs-deps-update : # # Check for outdated dependencies and automatically update them using pnpm
0 commit comments