Skip to content

Commit

Permalink
Use GNU Make
Browse files Browse the repository at this point in the history
Making things easier to run on CI and locally.
  • Loading branch information
lcobucci committed Jul 2, 2020
1 parent 5ca8aeb commit bff03fe
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/.gitignore export-ignore
/.*.yml export-ignore
/*.dist export-ignore
/Makefile export-ignore
/README.md export-ignore
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ cache:
before_install:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"

install: travis_retry composer install
install: travis_retry make vendor

script:
- ./vendor/bin/phpunit
- make unit-test

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

- stage: Code Quality
env: CODE_STANDARD=1
script:
- ./vendor/bin/phpcs
- make coding-standard

- stage: Code Quality
env: STATIC_ANALYSIS=1
script:
- ./vendor/bin/phpstan analyse
- make static-analysis

- stage: Code Quality
env: MUTATION_TESTS=1
before_script:
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for mutation tests"; exit 1; fi
script:
- ./vendor/bin/infection --threads=$(nproc) --min-msi=100 --min-covered-msi=100
- make mutation-test
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MIN_MSI=100
MIN_COVERED_MSI=100

ifeq ("${CI}", "true")
PARALLELISM=4
else
PARALLELISM=$(shell nproc)
endif

.PHONY: valid test coding-standard-fix coding-standard static-analysis unit-test mutation-test

valid: coding-standard-fix coding-standard static-analysis test

test: unit-test mutation-test

vendor: composer.json
composer install $(EXTRA_FLAGS)
@touch -c vendor

coding-standard: vendor
vendor/bin/phpcs --parallel=$(PARALLELISM)

coding-standard-fix: vendor
vendor/bin/phpcbf --parallel=$(PARALLELISM) || true

static-analysis: vendor
vendor/bin/phpstan analyse $(EXTRA_FLAGS)

unit-test: vendor
vendor/bin/phpunit --testsuite unit --stop-on-error --stop-on-failure $(EXTRA_FLAGS)

mutation-test: vendor
vendor/bin/infection --no-progress -j=$(PARALLELISM) -s --min-msi=$(MIN_MSI) --min-covered-msi=$(MIN_COVERED_MSI) $(EXTRA_FLAGS)

0 comments on commit bff03fe

Please sign in to comment.