Skip to content

Commit 6e97425

Browse files
authored
Merge pull request #390 from WyriHaximus/detect-wsl
Detect WSL and only use more then 1 thread when NOT on WSL
2 parents 5f632c3 + 5a9549a commit 6e97425

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,36 @@ else
2424
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine3.12${SLIM_DOCKER_IMAGE}-dev"
2525
endif
2626

27+
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
28+
THREADS=1
29+
else
30+
THREADS=$(shell nproc)
31+
endif
32+
2733
all: ## Runs everything ###
2834
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE)
2935

3036
syntax-php: ## Lint PHP syntax
3137
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
3238

3339
cs-fix: ## Fix any automatically fixable code style issues
34-
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(shell nproc) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml -vvvv
40+
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml -vvvv
3541

3642
cs: ## Check the code for code style issues
37-
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(shell nproc) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
43+
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
3844

3945
stan: ## Run static analysis (PHPStan)
4046
$(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c ./etc/qa/phpstan.neon
4147

4248
psalm: ## Run static analysis (Psalm)
43-
$(DOCKER_RUN) vendor/bin/psalm --threads=$(shell nproc) --shepherd --stats --config=./etc/qa/psalm.xml
49+
$(DOCKER_RUN) vendor/bin/psalm --threads=$(THREADS) --shepherd --stats --config=./etc/qa/psalm.xml
4450

4551
unit-testing: ## Run tests
4652
$(DOCKER_RUN) vendor/bin/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml
4753
$(DOCKER_RUN) test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./var/tests-unit-clover-coverage.xml && vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true
4854

4955
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) --ignore-msi-with-no-mutations || (cat ./var/infection.log && false)
56+
$(DOCKER_RUN) vendor/bin/roave-infection-static-analysis-plugin --ansi --min-msi=100 --min-covered-msi=100 --threads=$(THREADS) --ignore-msi-with-no-mutations || (cat ./var/infection.log && false)
5157

5258
composer-require-checker: ## Ensure we require every package used in this package directly
5359
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json

0 commit comments

Comments
 (0)