diff --git a/.dependabot/config.yml b/.dependabot/config.yml new file mode 100644 index 0000000..b2fa563 --- /dev/null +++ b/.dependabot/config.yml @@ -0,0 +1,16 @@ +# https://dependabot.com/docs/config-file/ + +version: 1 + +update_configs: + - default_assignees: + - "mimmi20" + default_reviewers: + - "mimmi20" + directory: "/" + package_manager: "php:composer" + update_schedule: "live" + version_requirement_updates: "increase_versions" + commit_message: + prefix: "Build" + include_scope: true diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..7120338 --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,246 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions + +on: + - pull_request + - push + +name: Continuous Integration + +jobs: + validate: + name: Validate + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: 7.1 + extension-csv: mbstring, dom, xmlwriter #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: none #optional + + - name: Validate composer.json + run: composer validate + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + + - name: Run localheinz/composer-normalize + run: composer normalize --dry-run + + install: + name: Install/Update with composer + + needs: validate + + runs-on: ${{ matrix.operating-system }} + + strategy: + fail-fast: false + max-parallel: 15 + matrix: + php-versions: + - 7.1 + - 7.2 + - 7.3 + - 7.4 + + operating-system: + - ubuntu-16.04 + - ubuntu-18.04 # ubuntu-latest + - windows-2016 + - windows-2019 # windows-latest + - macOS-10.14 # macOS-latest + + dependencies: + - "--prefer-lowest" + - "" + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, dom, xmlwriter #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: none #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv ${{ matrix.dependencies }} + + coding-standards: + name: "Coding Standards" + + needs: install + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: 7.1 + extension-csv: mbstring, dom, xmlwriter #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: none #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + + - name: Run friendsofphp/php-cs-fixer + run: vendor/bin/php-cs-fixer fix --dry-run -vv + + - name: Run squizlabs/php_codesniffer + run: vendor/bin/phpcs --colors + + static-code-analysis: + name: Static Code Analysis + + needs: install + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: 7.1 + extension-csv: mbstring, dom, xmlwriter #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: none #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + + - name: Run phpstan/phpstan + run: vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress + + tests: + name: UnitTests + + needs: + - coding-standards + - static-code-analysis + + runs-on: ${{ matrix.operating-system }} + + strategy: + fail-fast: false + max-parallel: 15 + matrix: + php-versions: + - 7.1 + - 7.2 + - 7.3 + - 7.4 + + operating-system: + - ubuntu-16.04 + - ubuntu-18.04 # ubuntu-latest + - windows-2016 + - windows-2019 # windows-latest + - macOS-10.14 # macOS-latest + + dependencies: + - "--prefer-lowest" + - "" + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, dom, xmlwriter #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: none #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv ${{ matrix.dependencies }} + + - name: Run unit tests with phpunit/phpunit + run: vendor/bin/phpunit -c phpunit.xml --colors --no-coverage + + code-coverage: + name: Code Coverage + + needs: tests + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: 7.1 + extension-csv: mbstring, dom, xmlwriter, xdebug #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: xdebug #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + + - name: Collect code coverage with Xdebug and phpunit/phpunit + run: vendor/bin/phpunit -c phpunit.xml --colors --coverage-clover=clover.xml --coverage-text + + - name: Download php-coveralls.phar + run: wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar + + - name: Upload coverage to Coveralls + run: php php-coveralls.phar --verbose --coverage_clover=clover.xml + env: + COVERALLS_REPO_TOKEN: ${{secrets.COVERALLS_REPO_TOKEN}} + COVERALLS_RUN_LOCALLY: 1 + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1.0.2 + with: + token: ${{secrets.CODECOV_TOKEN}} + file: clover.xml + flags: phpunit + + mutation-tests: + name: Mutation Tests + + needs: + - tests + - code-coverage + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Install PHP + uses: shivammathur/setup-php@1.3.9 + with: + php-version: 7.1 + extension-csv: mbstring, dom, xmlwriter, xdebug #optional + ini-values-csv: "opcache.enable=1, opcache.enable_cli=1, zend.assertions=1, assert.exception=On" #optional + coverage: xdebug #optional + + - name: Update dependencies with composer + run: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + + - name: Run mutation tests with infection/infection + run: vendor/bin/infection --min-covered-msi=95 --min-msi=95 diff --git a/.github/workflows/lock-closed-issues.yml b/.github/workflows/lock-closed-issues.yml new file mode 100644 index 0000000..b0cdf81 --- /dev/null +++ b/.github/workflows/lock-closed-issues.yml @@ -0,0 +1,13 @@ +name: Lock closed issue + +on: + issues: + types: [closed] + +jobs: + lock: + runs-on: ubuntu-latest + steps: + - uses: Dunning-Kruger/lock-issues@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..9fd8518 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,27 @@ +name: Close stale issues and pull requests + +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + days-before-stale: 60 + days-before-close: 7 + stale-issue-message: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + stale-pr-message: > + This PR has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + stale-issue-label: 'no-issue-activity' + stale-pr-label: 'no-pr-activity' diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..f4bde2f --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,191 @@ +# PHP +# Test and package your PHP project. +# Add steps that run tests, save build artifacts, deploy, and more: +# https://docs.microsoft.com/azure/devops/pipelines/languages/php + +stages: + - stage: validate + displayName: 'Validate composer.json and Check composer normalisation' + jobs: + - job: ComposerValidate + displayName: 'Validate composer.json' + variables: + phpVersion: 7.1 + pool: + vmImage: 'ubuntu-16.04' # ubuntu-latest + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer validate + displayName: 'composer validate' + - job: ComposerNormalize + variables: + phpVersion: 7.1 + pool: + vmImage: 'ubuntu-16.04' # ubuntu-latest + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + displayName: 'composer update' + - script: composer normalize --dry-run + displayName: 'composer normalize' + + - stage: install + displayName: 'Install/Update with composer on multiple platforms and php versions' + dependsOn: validate + jobs: + - job: install + displayName: 'Install/Update with composer' + strategy: + matrix: + linux_1604_php71: + imageName: "ubuntu-16.04" # ubuntu-latest + php_version: "7.1" + #mac_php71: + # imageName: "macOS-10.14" # macOS-latest + # php_version: "7.1" + #windows_2016_php71: + # imageName: "vs2017-win2016" + # php_version: "7.1" + #windows_2019_php71: + # imageName: "windows-2019" # windows-latest + # php_version: "7.1" + linux_1604_php72: + imageName: "ubuntu-16.04" # ubuntu-latest + php_version: "7.2" + #mac_php72: + # imageName: "macOS-10.14" # macOS-latest + # php_version: "7.2" + #windows_2016_php72: + # imageName: "vs2017-win2016" + # php_version: "7.2" + #windows_2019_php72: + # imageName: "windows-2019" # windows-latest + # php_version: "7.2" + linux_1604_php73: + imageName: "ubuntu-16.04" # ubuntu-latest + php_version: "7.3" + #mac_php73: + # imageName: "macOS-10.14" # macOS-latest + # php_version: "7.3" + #windows_2016_php73: + # imageName: "vs2017-win2016" + # php_version: "7.3" + #windows_2019_php73: + # imageName: "windows-2019" # windows-latest + # php_version: "7.3" + maxParallel: 15 + variables: + phpVersion: $(php_version) + pool: + vmImage: $(imageName) + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + displayName: 'composer update' + + - stage: coding_standards + displayName: 'check Coding Standards' + dependsOn: install + jobs: + - job: phpcs + displayName: 'Run squizlabs/php_codesniffer' + variables: + phpVersion: 7.1 + pool: + vmImage: 'ubuntu-16.04' # ubuntu-latest + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + displayName: 'composer update' + - script: vendor/bin/phpcs --colors + displayName: 'phpcs' + + - job: phpCsFixer + displayName: 'Run friendsofphp/php-cs-fixer' + variables: + phpVersion: 7.1 + pool: + vmImage: 'ubuntu-16.04' # ubuntu-latest + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + displayName: 'composer update' + - script: vendor/bin/php-cs-fixer fix --dry-run -vv + displayName: 'php-cs-fixer' + + - stage: static_code_analysis + displayName: 'Static Code Analysis' + dependsOn: install + jobs: + - job: phpstan + displayName: 'Run phpstan/phpstan' + variables: + phpVersion: 7.1 + pool: + vmImage: 'ubuntu-16.04' # ubuntu-latest + steps: + - script: | + sudo rm /etc/php/$(phpVersion)/cli/conf.d/20-xdebug.ini + sudo update-alternatives --set php /usr/bin/php$(phpVersion) + sudo update-alternatives --set phar /usr/bin/phar$(phpVersion) + sudo update-alternatives --set phpdbg /usr/bin/phpdbg$(phpVersion) + sudo update-alternatives --set php-cgi /usr/bin/php-cgi$(phpVersion) + sudo update-alternatives --set phar.phar /usr/bin/phar.phar$(phpVersion) + php -version + displayName: 'Use PHP version $(phpVersion)' + - script: composer self-update + displayName: 'composer self-update' + - script: composer update --optimize-autoloader --prefer-dist --prefer-stable --no-progress --no-interaction --no-suggest -vv + displayName: 'composer update' + - script: vendor/bin/phpstan analyse -c phpstan.neon --memory-limit=768M --no-progress + displayName: 'phpstan'