|
1 |
| -all: |
2 |
| - composer run-script qa-all --timeout=0 |
| 1 | +# set all to phony |
| 2 | +SHELL=bash |
3 | 3 |
|
4 |
| -all-extended: |
5 |
| - composer run-script qa-all-extended --timeout=0 |
| 4 | +.PHONY: * |
6 | 5 |
|
7 |
| -ci: |
8 |
| - composer run-script qa-ci --timeout=0 |
| 6 | +DOCKER_CGROUP:=$(shell cat /proc/1/cgroup | grep docker | wc -l) |
| 7 | +COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer/cache) |
9 | 8 |
|
10 |
| -ci-extended: |
11 |
| - composer run-script qa-ci-extended --timeout=0 |
| 9 | +ifneq ("$(wildcard /.dockerenv)","") |
| 10 | + IN_DOCKER=TRUE |
| 11 | +else ifneq ("$(DOCKER_CGROUP)","0") |
| 12 | + IN_DOCKER=TRUE |
| 13 | +else |
| 14 | + IN_DOCKER=FALSe |
| 15 | +endif |
12 | 16 |
|
13 |
| -ci-windows: |
14 |
| - composer run-script qa-ci-windows --timeout=0 |
| 17 | +ifeq ("$(IN_DOCKER)","TRUE") |
| 18 | + DOCKER_RUN= |
| 19 | +else |
| 20 | + DOCKER_RUN=docker run --rm -it \ |
| 21 | + -v "`pwd`:`pwd`" \ |
| 22 | + -v "${COMPOSER_CACHE_DIR}:/home/app/.composer/cache" \ |
| 23 | + -w "`pwd`" \ |
| 24 | + "wyrihaximusnet/php:7.4-nts-alpine3.12-dev" |
| 25 | +endif |
15 | 26 |
|
16 |
| -contrib: |
17 |
| - composer run-script qa-contrib --timeout=0 |
| 27 | +all: ## Runs everything ### |
| 28 | + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE) |
18 | 29 |
|
19 |
| -init: |
20 |
| - composer ensure-installed |
| 30 | +syntax-php: ## Lint PHP syntax |
| 31 | + $(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor . |
21 | 32 |
|
22 |
| -cs: |
23 |
| - composer cs |
| 33 | +cs-fix: ## Fix any automatically fixable code style issues |
| 34 | + $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) -vvvv |
24 | 35 |
|
25 |
| -cs-fix: |
26 |
| - composer cs-fix |
| 36 | +cs: ## Check the code for code style issues |
| 37 | + $(DOCKER_RUN) vendor/bin/phpcs --parallel=$(shell nproc) |
27 | 38 |
|
28 |
| -infection: |
29 |
| - composer infection |
| 39 | +stan: ## Run static analysis (PHPStan) |
| 40 | + $(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon |
30 | 41 |
|
31 |
| -unit: |
32 |
| - composer run-script unit --timeout=0 |
| 42 | +psalm: ## Run static analysis (Psalm) |
| 43 | + $(DOCKER_RUN) vendor/bin/psalm --threads=$(shell nproc) --shepherd --stats |
33 | 44 |
|
34 |
| -stan: |
35 |
| - composer run-script stan --timeout=0 |
| 45 | +unit-testing: ## Run tests |
| 46 | + $(DOCKER_RUN) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml |
| 47 | + $(DOCKER_RUN) test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./build/logs/clover.xml && vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./build/logs/coveralls-upload.json || true |
36 | 48 |
|
37 |
| -unit-coverage: |
38 |
| - composer run-script unit-coverage --timeout=0 |
| 49 | +mutation-testing: ## Run mutation testing |
| 50 | + $(DOCKER_RUN) vendor/bin/roave-infection-static-analysis-plugin --ansi --min-msi=100 --min-covered-msi=100 --threads=$(shell nproc) |
39 | 51 |
|
40 |
| -ci-coverage: init |
41 |
| - composer ci-coverage |
| 52 | +composer-require-checker: ## Ensure we require every package used in this package directly |
| 53 | + $(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json |
| 54 | + |
| 55 | +composer-unused: ## Ensure we don't require any package we don't use in this package directly |
| 56 | + $(DOCKER_RUN) composer unused --ansi |
| 57 | + |
| 58 | +backward-compatibility-check: ## Check code for backwards incompatible changes |
| 59 | + $(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check || true |
| 60 | + |
| 61 | +shell: ## Provides Shell access in the expected environment ### |
| 62 | + $(DOCKER_RUN) ash |
| 63 | + |
| 64 | +task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ### |
| 65 | + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]' |
| 66 | + |
| 67 | +help: ## Show this help ### |
| 68 | + @printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n" |
| 69 | + @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#' |
0 commit comments