Skip to content
Merged
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
25 changes: 13 additions & 12 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@
* text=auto

# Do not put this files on a distribution package (by .gitignore)
/vendor export-ignore
/composer.lock export-ignore
/tools/ export-ignore
/vendor/ export-ignore
/composer.lock export-ignore

# Do not put this files on a distribution package
/build/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/.github/ export-ignore
/build/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/.scrutinizer.yml export-ignore
/phpcs.xml.dist export-ignore
/phpstan.xml.dist export-ignore
/phpunit.xml.dist export-ignore
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# see https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners
/.github/* @phpcfdi/core-mantainers
106 changes: 106 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: build
on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
schedule:
- cron: '0 16 * * 0' # sunday 16:00

jobs:

ci: # this job runs all the development tools and upload code coverage to scrutinizer

name: PHP 8.0 (full)
runs-on: "ubuntu-latest"

steps:

- name: Checkout
uses: actions/checkout@v2

# see https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring, openssl
coverage: xdebug
tools: composer:v2, phpcs, php-cs-fixer, phpstan, cs2pr
env:
fail-fast: true

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist

- name: Code style (phpcs)
run: phpcs -q --report=checkstyle | cs2pr

- name: Code style (php-cs-fixer)
run: php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

- name: Tests (phpunit with code coverage)
run: vendor/bin/phpunit --testdox --verbose --coverage-clover=build/coverage-clover.xml --coverage-xml=build/coverage --log-junit=build/coverage/junit.xml

- name: Code analysis (phpstan)
run: phpstan analyse --no-progress --verbose

# see https://github.com/marketplace/actions/action-scrutinizer
- name: Upload code coverage to scrutinizer
uses: sudo-bot/action-scrutinizer@latest
with:
cli-args: "--format=php-clover build/coverage-clover.xml"
continue-on-error: true

build: # this job runs tests on all php supported versions

name: PHP ${{ matrix.php-versions }} (tests)
runs-on: "ubuntu-latest"

strategy:
matrix:
php-versions: ['7.3', '7.4']

steps:

- name: Checkout
uses: actions/checkout@v2

# see https://github.com/marketplace/actions/setup-php-action
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, openssl
coverage: none
tools: composer:v2, cs2pr
env:
fail-fast: true

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install project dependencies
run: composer upgrade --no-interaction --no-progress --prefer-dist

- name: Tests
run: vendor/bin/phpunit --testdox --verbose
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# do not include this files on git
/vendor
/tools/
/vendor/
/composer.lock
7 changes: 7 additions & 0 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^3.1.0" installed="3.1.0" location="./tools/php-cs-fixer" copy="false"/>
<phar name="phpcs" version="^3.6.0" installed="3.6.0" location="./tools/phpcs" copy="false"/>
<phar name="phpcbf" version="^3.6.0" installed="3.6.0" location="./tools/phpcbf" copy="false"/>
<phar name="phpstan" version="^0.12.98" installed="0.12.98" location="./tools/phpstan" copy="false"/>
</phive>
40 changes: 21 additions & 19 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,50 +1,52 @@
<?php

/**
* @noinspection PhpUndefinedClassInspection
* @noinspection PhpUndefinedNamespaceInspection
* @see https://cs.symfony.com/doc/ruleSets/
* @see https://cs.symfony.com/doc/rules/
*/

declare(strict_types=1);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setCacheFile(__DIR__ . '/build/.php_cs.cache')
->setCacheFile(__DIR__ . '/build/php_cs.cache')
->setRules([
'@PSR2' => true,
'@PHP70Migration' => true,
'@PHP70Migration:risky' => true,
'@PHP71Migration' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
// PSR12 (remove when php-cs-fixer reaches ^3.1.1)
'class_definition' => ['space_before_parenthesis' => true],
// symfony
'class_attributes_separation' => true,
// 'class_attributes_separation' => true, // conflict with PSR12
'whitespace_after_comma_in_array' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'function_typehint_space' => true,
'no_alias_functions' => true,
'trailing_comma_in_multiline_array' => true,
'new_with_braces' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'object_operator_without_whitespace' => true,
'binary_operator_spaces' => true,
'phpdoc_scalar' => true,
'self_accessor' => true,
'no_trailing_comma_in_singleline_array' => true,
'single_quote' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'no_whitespace_in_blank_line' => true,
'yoda_style' => ['equal' => true, 'identical' => true, 'less_and_greater' => null],
'standardize_not_equals' => true,
// contrib
'concat_space' => ['spacing' => 'one'],
'not_operator_with_successor_space' => true,
'single_blank_line_before_namespace' => true,
'linebreak_after_opening_tag' => true,
'blank_line_after_opening_tag' => true,
'ordered_imports' => true,
'array_syntax' => ['syntax' => 'short'],
// symfony:risky
'no_alias_functions' => true,
'self_accessor' => true,
// contrib
'not_operator_with_successor_space' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->append([__FILE__])
->exclude(['vendor', 'build'])
)
;
16 changes: 8 additions & 8 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
filter:
excluded_paths:
- 'tests/'
dependency_paths:
- 'tools/'
- 'vendor/'

build:
dependencies:
override:
- composer self-update --no-interaction --no-progress
- composer remove squizlabs/php_codesniffer friendsofphp/php-cs-fixer phpstan/phpstan --dev --no-interaction --no-progress --no-update
- composer install --no-interaction
- composer update --no-interaction --prefer-dist
nodes:
php:
analysis: # see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/
project_setup: {override: true}
tests:
override:
- php-scrutinizer-run --enable-security-analysis
- command: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
coverage:
file: coverage.clover
format: clover

tools:
external_code_coverage: true
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

Loading