Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEST: Testing GitHub Actions (do not merge) #6

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ indent_size = 4

[*.md]
indent_size = 2

[Makefile]
indent_style = tab
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PATH_add vendor/bin
PATH_add tools
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/test export-ignore
/Makefile
8 changes: 4 additions & 4 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ jobs:
${{ runner.os }}-composer-

- name: Install Dependencies
run: composer install --no-interaction --prefer-dist --no-progress
run: make install

- name: Check Code Style
run: composer style:check
run: make check-style

- name: Run Static Analysis
run: composer test:static -- --no-progress
run: make static-check

- name: Run Unit & Functional Tests
run: composer test:coverage
run: make coverage

- name: Upload Coverage
uses: codecov/codecov-action@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,4 @@ Temporary Items
/coverage.xml
/phpstan.neon
/captainhook.config.json
/tools
98 changes: 98 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
COMPOSER_VERSION := 2.5.8
PHPUNIT_VERSION := 10.2.4
PHPSTAN_VERSION := 1.10.25
PHP_CS_FIXER_VERSION := 3.21.1
PHPUNIT_GLOBALS_VERSION := 3.1.2

SRC_FILES := $(shell find src test -name '*.php')


## Manage Dependencies
.PHONY: install
install: tools/composer
php tools/composer install

.PHONY: update
update: composer.lock vendor

composer.lock vendor: tools/composer composer.json
php tools/composer install


## PHP CS Fixer
.PHONY: check-style
check-style: tools/php-cs-fixer
php tools/php-cs-fixer fix -v --ansi --dry-run --diff

.PHONY: fix-style
fix-style: tools/php-cs-Fixer
php tools/php-cs-fixer fix -v --ansi


## PHPStan
.PHONY: static-check
static-check: tools/phpstan
php tools/phpstan analyze --ansi


## PHPUnit
.PHONY: test
test: tools/phpunit tools/phpunit.d/zalas-phpunit-globals-extension.phar
php tools/phpunit --colors=always

.PHONY: coverage
coverage: coverage.xml

coverage.xml: tools/phpunit tools/phpunit.d/zalas-phpunit-globals-extension.phar $(SRC_FILES)
php tools/phpunit --coverage-clover=coverage.xml


.PHONY: all-tests
all-tests: check-style static-check test


## Tool Aliases
.PHONY: composer
composer: tools/composer

.PHONY: php-cs-fixer
php-cs-fixer: tools/php-cs-fixer

.PHONY: phpstan
phpstan: tools/phpstan

.PHONY: phpunit
phpunit: tools/phpunit


## Download Tools
tools:
@mkdir -p tools

tools/phpunit.d:
@mkdir -p tools/phpunit.d

tools/composer: tools/composer-installer | tools
@php tools/composer-installer --version=${COMPOSER_VERSION} --filename=tools/composer

tools/composer-installer: | tools
@curl -s -o tools/composer-installer https://getcomposer.org/installer
@echo "`curl -s https://composer.github.io/installer.sig` tools/composer-installer" | sha384sum -c -

tools/php-cs-fixer: | tools
@curl -s -L -o tools/php-cs-fixer https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v$(PHP_CS_FIXER_VERSION)/php-cs-fixer.phar

tools/phpstan: | tools
@curl -s -L -o tools/phpstan https://github.com/phpstan/phpstan/releases/download/$(PHPSTAN_VERSION)/phpstan.phar

tools/phpunit: | tools
@curl -s -L -o tools/phpunit https://phar.phpunit.de/phpunit-$(PHPUNIT_VERSION).phar

tools/phpunit.d/zalas-phpunit-globals-extension.phar: | tools/phpunit.d
@curl -s -L -o tools/phpunit.d/zalas-phpunit-globals-extension.phar https://github.com/jakzal/phpunit-globals/releases/download/v$(PHPUNIT_GLOBALS_VERSION)/zalas-phpunit-globals-extension.phar


## Cleanup
.PHONY: clean
clean:
rm -rf tools vendor composer.lock coverage.xml
6 changes: 3 additions & 3 deletions captainhook.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"conditions": []
},
{
"action": "composer style:check -- --no-ansi",
"action": "make check-style",
"options": [],
"conditions": []
},
{
"action": "composer test:static -- --no-ansi",
"action": "make static-check",
"options": [],
"conditions": []
},
{
"action": "composer test:phpunit -- --colors=never",
"action": "make test",
"options": [],
"conditions": []
}
Expand Down
26 changes: 1 addition & 25 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,13 @@
"captainhook/captainhook": "~5.16.4",
"captainhook/plugin-composer": "~5.3.3",
"ergebnis/composer-normalize": "~2.33.0",
"friendsofphp/php-cs-fixer": "^3.21.1",
"maglnet/composer-require-checker": "~4.6.0",
"mockery/mockery": "~1.6.2",
"phpstan/extension-installer": "~1.3.1",
"phpstan/phpstan": "~1.10.25",
"phpstan/phpstan-deprecation-rules": "~1.1.3",
"phpstan/phpstan-mockery": "~1.1.1",
"phpstan/phpstan-phpunit": "~1.3.13",
"phpstan/phpstan-strict-rules": "~1.5.1",
"phpunit/phpunit": "~10.2.4",
"zalas/phpunit-globals": "~3.1.2"
"phpstan/phpstan-strict-rules": "~1.5.1"
},
"minimum-stability": "stable",
"autoload": {
Expand All @@ -64,25 +60,5 @@
"branch-alias": {
"dev-develop": "1.0.x-dev"
}
},
"scripts": {
"style:check": "php-cs-fixer fix -v --ansi --dry-run --diff",
"style:fix": "php-cs-fixer fix -v --ansi",
"test": [
"@style:check",
"@test:static",
"@test:phpunit"
],
"test:coverage": "phpunit --coverage-clover=coverage.xml",
"test:phpunit": "phpunit --colors=always",
"test:static": "phpstan analyze --ansi"
},
"scripts-descriptions": {
"style:check": "Check all files for code style violations.",
"style:fix": "Automatically fix code style in all files.",
"test": "Check code style, static analysis, and unit tests.",
"test:coverage": "Run unit tests and generate coverage report.",
"test:phpunit": "Run unit & functional tests.",
"test:static": "Run phpstan static analysis."
}
}
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ parameters:
- '/Readonly property BeBat\\ConsoleColor\\Style::.+ is assigned outside of the constructor/'
- '/Call to an undefined method BeBat\\Verify\\API\\Value::/'
- '/Access to an undefined property BeBat\\Verify\\API\\Value::/'
- '/Attribute class Zalas\\PHPUnit\\Globals\\Attribute\\Putenv does not exist/'
3 changes: 2 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
failOnWarning="true"
failOnDeprecation="true"
failOnNotice="true"
testdox="true">
testdox="true"
extensionsDirectory="tools/phpunit.d">
<testsuites>
<testsuite name="Console Color Tests">
<directory>test</directory>
Expand Down