@@ -3,13 +3,23 @@ SHELL=bash
33
44.PHONY : *
55
6+ DOCKER_CGROUP: =$(shell cat /proc/1/cgroup | grep docker | wc -l)
7+
68ifneq ("$(wildcard /.dockerenv) ","")
7- DOCKER_RUN =
9+ IN_DOCKER =TRUE
10+ else ifneq ("$(DOCKER_CGROUP)","0")
11+ IN_DOCKER=TRUE
12+ else
13+ IN_DOCKER =FALSe
14+ endif
15+
16+ ifeq ("$(IN_DOCKER ) ","TRUE")
17+ DOCKER_RUN=
818else
919DOCKER_RUN=docker run --rm -it \
10- -v `pwd`:`pwd` \
11- -w `pwd` \
12- "wyrihaximusnet/php:7.4-zts-alpine3.11 -dev"
20+ -v " `pwd`:`pwd`" \
21+ -w " `pwd`" \
22+ "wyrihaximusnet/php:7.4-zts-alpine3.12 -dev"
1323endif
1424
1525all : lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused
@@ -18,16 +28,16 @@ lint:
1828$(DOCKER_RUN ) vendor/bin/parallel-lint --exclude vendor .
1929
2030cs :
21- $(DOCKER_RUN ) vendor/bin/phpcs --parallel=$(nproc )
31+ $(DOCKER_RUN ) vendor/bin/phpcs --parallel=$(shell nproc)
2232
2333cs-fix :
24- $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(nproc )
34+ $(DOCKER_RUN ) vendor/bin/phpcbf --parallel=$(shell nproc)
2535
2636stan :
2737$(DOCKER_RUN ) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon
2838
2939psalm :
30- $(DOCKER_RUN ) vendor/bin/psalm --threads=$(nproc ) --shepherd --stats
40+ $(DOCKER_RUN ) vendor/bin/psalm --threads=$(shell nproc) --shepherd --stats
3141
3242unit :
3343$(DOCKER_RUN ) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml
@@ -36,7 +46,7 @@ unit-ci: unit
3646if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && sleep 3 && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
3747
3848infection :
39- $(DOCKER_RUN ) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(nproc )
49+ $(DOCKER_RUN ) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(shell nproc)
4050
4151composer-require-checker :
4252$(DOCKER_RUN ) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json
0 commit comments