forked from paratestphp/paratest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (65 loc) · 3.23 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
SRCS := $(shell find ./src ./test -type f -not -path "*/tmp/*")
LOCAL_BASE_BRANCH ?= $(shell git show-branch | sed "s/].*//" | grep "\*" | grep -v "$$(git rev-parse --abbrev-ref HEAD)" | head -n1 | sed "s/^.*\[//")
ifeq ($(strip $(LOCAL_BASE_BRANCH)),)
LOCAL_BASE_BRANCH := HEAD^
endif
BASE_BRANCH ?= $(LOCAL_BASE_BRANCH)
all: csfix static-analysis code-coverage
@echo "Done."
vendor: composer.json
composer update
#composer bump
touch vendor
.PHONY: csfix
csfix: vendor
vendor/bin/phpcbf || true
vendor/bin/phpcs --cache
.PHONY: static-analysis
static-analysis: vendor
php -d zend.assertions=1 vendor/bin/phpstan $(PHPSTAN_ARGS)
coverage/junit.xml: vendor $(SRCS) Makefile
php -d zend.assertions=1 \
-d pcov.enabled=1 \
vendor/bin/phpunit \
--coverage-clover=coverage/clover.xml \
--coverage-xml=coverage/xml \
--coverage-html=coverage/html \
--log-junit=$@ \
$(PHPUNIT_ARGS) \
|| (rm $@ && exit 1)
.PHONY: test
test: coverage/junit.xml
.PHONY: code-coverage
code-coverage: coverage/junit.xml
echo "Base branch: $(BASE_BRANCH)"
php -d zend.assertions=1 \
-d pcov.enabled=1 \
vendor/bin/infection run \
--threads=$(shell nproc) \
--git-diff-lines \
--git-diff-base=$(BASE_BRANCH) \
--skip-initial-tests \
--initial-tests-php-options="'-d' 'pcov.enabled=1'" \
--coverage=coverage \
--show-mutations \
--verbose \
--min-msi=100 \
$(INFECTION_ARGS)
.PHONY: regenerate-fixture-results
regenerate-fixture-results: vendor
vendor/bin/phpunit \
--log-junit test/fixtures/special_chars/data-provider-with-special-chars.xml \
--no-configuration \
test/fixtures/special_chars/UnitTestWithDataProviderSpecialCharsTest.php \
> /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/ErrorTest.php --log-junit test/fixtures/common_results/junit/ErrorTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/FailureTest.php --log-junit test/fixtures/common_results/junit/FailureTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/IncompleteTest.php --log-junit test/fixtures/common_results/junit/IncompleteTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/RiskyTest.php --log-junit test/fixtures/common_results/junit/RiskyTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/SkippedTest.php --log-junit test/fixtures/common_results/junit/SkippedTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/SuccessTest.php --log-junit test/fixtures/common_results/junit/SuccessTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/WarningTest.php --log-junit test/fixtures/common_results/junit/WarningTest.xml > /dev/null || true
vendor/bin/phpunit --no-configuration test/fixtures/common_results/ --log-junit test/fixtures/common_results/combined.xml > /dev/null || true
find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#$(PWD)#.#g'
find test/fixtures/ -type f -name "*.xml" -print0 | xargs -0 sed -i 's#time="........"#time="1.234567"#g'
sed -i 's#name="./test/fixtures/common_results"#name=""#g' test/fixtures/common_results/combined.xml