This repository has been archived by the owner on Jul 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
464 additions
and
585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/vendor/ | ||
/.php_cs.cache | ||
/artifacts/ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
language: php | ||
|
||
sudo: false | ||
matrix: | ||
include: | ||
- php: 7.0 | ||
- php: 7.1 | ||
- php: 7.2 | ||
- php: nightly | ||
fast_finish: true | ||
allow_failures: | ||
- php: nightly | ||
|
||
before_install: phpenv config-rm xdebug.ini || true | ||
install: composer install --prefer-dist --no-progress --no-interaction | ||
script: make test | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
install: make ci-install | ||
script: make ci | ||
|
||
sudo: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,86 @@ | ||
SHELL := /bin/bash -o pipefail | ||
.DEFAULT_GOAL := test | ||
|
||
ifdef CI | ||
_DEP_PREREQ += artifacts/logs/ci-install | ||
endif | ||
|
||
################################################################################ | ||
# Internal variables | ||
################################################################################ | ||
|
||
# _SRC contains the paths to all PHP source files. | ||
_SRC ?= $(shell find ./src -name '*.php' 2> /dev/null) | ||
|
||
# _TEST_SRC contains the paths to all test files. | ||
_TEST_SRC := $(shell find ./test -type f 2> /dev/null) | ||
|
||
# This is used in lots of targets | ||
_ALL_SRC := $(_SRC) $(_TEST_SRC) | ||
|
||
################################################################################ | ||
# Commands (Phony Targets) | ||
################################################################################ | ||
|
||
# Run all tests. | ||
.PHONY: test | ||
test: vendor | ||
php --version | ||
vendor/bin/kahlan | ||
|
||
# Remove all files that match the patterns .gitignore. | ||
.PHONY: clean-all | ||
clean-all:: clean | ||
rm -rf ./vendor | ||
|
||
# Remove files that match the patterns .gitignore, excluding the vendor folder. | ||
.PHONY: clean | ||
clean:: | ||
@git check-ignore ./* | grep -v ^./vendor | xargs -t -n1 rm -rf | ||
|
||
# Perform code linting, syntax formatting, etc. | ||
.PHONY: lint | ||
lint: vendor | ||
vendor/bin/php-cs-fixer fix | ||
vendor/bin/phpstan analyze --configuration test/phpstan.neon --level=7 . | ||
lint: artifacts/logs/php-cs-fixer artifacts/logs/phpstan artifacts/logs/composer-validate | ||
|
||
# Perform pre-commit checks. | ||
.PHONY: prepare | ||
prepare: lint test | ||
|
||
vendor: composer.lock | ||
# Install CI dependencies | ||
.PHONY: ci-install | ||
ci-install: vendor | ||
|
||
# Run the CI build. | ||
.PHONY: ci | ||
ci: lint test | ||
|
||
################################################################################ | ||
# File Targets | ||
################################################################################ | ||
|
||
.DELETE_ON_ERROR: | ||
|
||
vendor: $(_DEP_PREREQ) composer.lock | ||
composer install | ||
@touch $@ | ||
|
||
composer.lock: composer.json | ||
composer update | ||
@touch $@ | ||
|
||
composer.json: | ||
composer init --no-interaction | ||
|
||
artifacts/logs/php-cs-fixer: vendor $(_ALL_SRC) | ||
@mkdir -p "$(@D)" | ||
vendor/bin/php-cs-fixer fix | tee "$@" | ||
|
||
artifacts/logs/phpstan: vendor $(_ALL_SRC) | ||
@mkdir -p "$(@D)" | ||
vendor/bin/phpstan analyze --configuration test/phpstan.neon --level=7 --no-progress . | tee "$@" | ||
|
||
artifacts/logs/composer-validate: composer.json | ||
@mkdir -p "$(@D)" | ||
composer validate --no-check-publish | tee "$@" | ||
|
||
artifacts/logs/ci-install: | ||
@mkdir -p "$(@D)" | ||
(phpenv config-rm xdebug.ini || true) | tee "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.