Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
🎉
  • Loading branch information
romm committed Nov 28, 2021
0 parents commit 396f64a
Show file tree
Hide file tree
Showing 449 changed files with 26,036 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
*.php text eol=lf

/.github/ export-ignore
/stubs/ export-ignore
/tests/ export-ignore

/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/infection.json.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
68 changes: 68 additions & 0 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Mutation tests
on:
push:
branches:
- master
pull_request:
jobs:
mutation:
name: Mutation tests
runs-on: ubuntu-latest
env:
php-version: 8.1
php-extensions: xdebug, yaml
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0 # Needed for the `git diff` used below for Infection

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.php-extensions }}
key: mutation-php-extensions-${{ runner.os }}-${{ env.php-version }}

- name: Cache PHP extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: ${{ env.php-extensions }}
ini-values: zend.assertions=1

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

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

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Creating var directory
run: mkdir -p var/cache

- name: Running mutation tests
if: github.ref == 'refs/heads/master'
run: php vendor/bin/infection --threads=$(nproc)
env:
INFECTION_BADGE_API_KEY: ${{ secrets.INFECTION_BADGE_API_KEY }}

- name: Running mutation tests
if: github.event_name == 'pull_request'
run: |
git fetch --depth=1 origin $GITHUB_BASE_REF
php vendor/bin/infection --threads=$(nproc) --git-diff-filter=AM --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered
64 changes: 64 additions & 0 deletions .github/workflows/quality-assurance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Coding Standards & Static Analysis
on: [ push ]
jobs:
qa:
name: Quality Assurance
runs-on: ubuntu-latest
env:
php-version: 8.1
php-extensions: xdebug, yaml
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.php-extensions }}
key: qa-php-extensions-${{ runner.os }}-${{ env.php-version }}

- name: Cache PHP extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.php-version }}
extensions: ${{ env.php-extensions }}
ini-values: zend.assertions=1

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

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

- name: Cache PHPStan results
uses: actions/cache@v2
with:
path: var/cache/phpstan
key: phpstan

- name: Install dependencies
run: composer update --prefer-dist --no-interaction

- name: Creating var directory
run: mkdir -p var/cache

- name: Running PHP Coding Standards Fixer
run: | # @todo remove PHP_CS_FIXER_IGNORE_ENV when PHP-CS-Fixer supports PHP 8.1
export PHP_CS_FIXER_IGNORE_ENV=1
php vendor/bin/php-cs-fixer fix --dry-run
- name: Running PHPStan
run: php vendor/bin/phpstan
59 changes: 59 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Tests
on: [ push ]
jobs:
tests:
name: PHP ${{ matrix.php }} / ${{ matrix.dependency-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [ 7.4, 8.0, 8.1 ]
dependency-version: [ prefer-lowest, prefer-stable ]
env:
php-extensions: xdebug, yaml
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.php-extensions }}
key: tests-php-extensions-${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependency-version }}

- name: Cache PHP extensions
uses: actions/cache@v2
with:
path: ${{ steps.extcache.outputs.dir }}
key: ${{ steps.extcache.outputs.key }}
restore-keys: ${{ steps.extcache.outputs.key }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.php-extensions }}
ini-values: zend.assertions=1

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

- name: Cache Composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ runner.os }}-${{ matrix.php }}-${{ matrix.dependency-version }}-${{ hashFiles('composer.json') }}

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction

- name: Running unit tests
run: php vendor/bin/phpunit --testsuite=unit

- name: Running functional tests
run: php vendor/bin/phpunit --testsuite=functional

- name: Running integration tests
run: php vendor/bin/phpunit --testsuite=integration
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
var
vendor
composer.lock
phpstan.neon
37 changes: 37 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

$finder = PhpCsFixer\Finder::create()->in([
'./src',
'./tests'
]);

if (PHP_VERSION_ID < 8_00_00) {
$finder = $finder
->notPath('Fixture/Attribute/AttributeWithArguments.php')
->notPath('Fixture/Object/ObjectWithAttributes.php')
->notPath('Fixture/Object/ObjectWithPropertyWithNativeUnionType.php')
->notPath('Integration/Mapping/Fixture/NativeUnionValues.php');
}

if (PHP_VERSION_ID < 8_01_00) {
$finder = $finder->notPath('Fixture/Enum/PureEnum.php');
$finder = $finder->notPath('Fixture/Enum/BackedStringEnum.php');
$finder = $finder->notPath('Fixture/Enum/BackedIntegerEnum.php');
$finder = $finder->notPath('Fixture/Object/ObjectWithPropertyWithNativeIntersectionType.php');
$finder = $finder->notPath('Integration/Mapping/Fixture/ReadonlyValues.php');
}

return (new PhpCsFixer\Config())
->setFinder($finder)
->setCacheFile('var/cache/.php_cs.cache')
->setRules([
'@PSR1' => true,
'@PSR12' => true,
'no_unused_imports' => true,
'no_extra_blank_lines' => true,
'no_empty_phpdoc' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
'remove_inheritdoc' => true
],
]);
Loading

0 comments on commit 396f64a

Please sign in to comment.