Skip to content

Commit 66c6d8e

Browse files
authored
Merge pull request #52 from lcobucci/improve-ci-and-tooling
Improve CI and tooling
2 parents 0b375f5 + fa39dd0 commit 66c6d8e

File tree

5 files changed

+58
-22
lines changed

5 files changed

+58
-22
lines changed

.gitattributes

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/templates export-ignore
2-
/tests export-ignore
3-
/.gitattributes export-ignore
4-
/.gitignore export-ignore
5-
/.scrutinizer.yml export-ignore
6-
/.travis.yml export-ignore
7-
/infection.json.dist export-ignore
8-
/phpcs.xml.dist export-ignore
9-
/phpstan.neon.dist export-ignore
10-
/phpunit.xml.dist export-ignore
11-
/README.md export-ignore
1+
/.github export-ignore
2+
/templates export-ignore
3+
/tests export-ignore
4+
/.gitattributes export-ignore
5+
/.gitignore export-ignore
6+
/.*.yml export-ignore
7+
/*.dist export-ignore
8+
/Makefile export-ignore
9+
/README.md export-ignore

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/vendor/
22
/composer.lock
33
/.phpcs.cache
4-
/infection-log.txt
4+
/infection.log
55
/.phpunit.result.cache

.travis.yml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
dist: trusty
2-
sudo: false
1+
os: linux
2+
dist: bionic
33
language: php
44

55
php:
@@ -12,12 +12,17 @@ cache:
1212

1313
before_install:
1414
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
15-
- composer self-update
1615

17-
install: travis_retry composer install
16+
install:
17+
- |
18+
if [ $TRAVIS_PHP_VERSION = 'nightly' ]; then
19+
travis_retry travis_retry make vendor EXTRA_FLAGS="--ignore-platform-reqs";
20+
else
21+
travis_retry travis_retry make vendor;
22+
fi
1823
1924
script:
20-
- ./vendor/bin/phpunit
25+
- make unit-test
2126

2227
jobs:
2328
allow_failures:
@@ -30,25 +35,25 @@ jobs:
3035
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
3136
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
3237
script:
33-
- ./vendor/bin/phpunit --coverage-clover ./clover.xml
38+
- make unit-test EXTRA_FLAGS="--coverage-clover ./clover.xml"
3439
after_script:
3540
- wget https://scrutinizer-ci.com/ocular.phar
3641
- php ocular.phar code-coverage:upload --format=php-clover ./clover.xml
3742

3843
- stage: Code Quality
3944
env: CODE_STANDARD=1
4045
script:
41-
- ./vendor/bin/phpcs
46+
- make coding-standard
4247

4348
- stage: Code Quality
4449
env: STATIC_ANALYSIS=1
4550
script:
46-
- ./vendor/bin/phpstan analyse
51+
- make static-analysis
4752

4853
- stage: Code Quality
4954
env: MUTATION_TESTS=1
5055
before_script:
5156
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
5257
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for mutation tests"; exit 1; fi
5358
script:
54-
- ./vendor/bin/infection --threads=$(nproc) --min-msi=100 --min-covered-msi=100
59+
- make mutation-test

Makefile

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
MIN_MSI=100
2+
MIN_COVERED_MSI=100
3+
4+
ifeq ("${CI}", "true")
5+
PARALLELISM=4
6+
else
7+
PARALLELISM=$(shell nproc)
8+
endif
9+
10+
.PHONY: valid test coding-standard-fix coding-standard static-analysis unit-test mutation-test
11+
12+
valid: coding-standard-fix coding-standard static-analysis test
13+
14+
test: unit-test mutation-test
15+
16+
vendor: composer.json
17+
composer install $(EXTRA_FLAGS)
18+
@touch -c vendor
19+
20+
coding-standard: vendor
21+
vendor/bin/phpcs --parallel=$(PARALLELISM)
22+
23+
coding-standard-fix: vendor
24+
vendor/bin/phpcbf --parallel=$(PARALLELISM) || true
25+
26+
static-analysis: vendor
27+
vendor/bin/phpstan analyse $(EXTRA_FLAGS)
28+
29+
unit-test: vendor
30+
vendor/bin/phpunit --testsuite unit --stop-on-error --stop-on-failure $(EXTRA_FLAGS)
31+
32+
mutation-test: vendor
33+
vendor/bin/infection --no-progress -j=$(PARALLELISM) -s --min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) $(EXTRA_FLAGS)

infection.json.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"directories": ["src"]
55
},
66
"logs": {
7-
"text": "infection-log.txt"
7+
"text": "infection.log"
88
}
99
}

0 commit comments

Comments
 (0)