Skip to content

Commit

Permalink
Support PHP 8 (#102)
Browse files Browse the repository at this point in the history
* Support PHP 8

* Update src/DependencyInjection/Configuration.php

Co-authored-by: Grégoire Hébert <[email protected]>

* bump php version

Co-authored-by: Grégoire Hébert <[email protected]>
  • Loading branch information
vincentchalamon and GregoireHebert authored Oct 29, 2020
1 parent c516006 commit 3092096
Show file tree
Hide file tree
Showing 34 changed files with 254 additions and 167 deletions.
64 changes: 64 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.feature]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2

[*.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.php]
indent_style = space
indent_size = 4

[*.sh]
indent_style = tab
indent_size = 4

[*.xml]
indent_style = space
indent_size = 4

[*.{yaml,yml}]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[.github/workflows/*.{yaml,yml}]
indent_style = space
indent_size = 2

[.php_cs{,.dist}]
indent_style = space
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4

[phpunit.xml{,.dist}]
indent_style = space
indent_size = 4
10 changes: 6 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,19 +143,21 @@ on DocuSign and store the private key on `features/var/jwt/docusign.pem`.

## Starting the demo project

You must install the [Symfony binary](https://symfony.com/download), then start the server:

```shell
features/console server:start
symfony serve --document-root=features/public
```

Then go to http://localhost:8000.
Then go to http://127.0.0.1:8000.

## Debugging

The [WebProfilerBundle](https://symfony.com/web-profiler-bundle) is available at http://localhost:8000/_profiler/.
The [WebProfilerBundle](https://symfony.com/web-profiler-bundle) is available at http://127.0.0.1:8000/_profiler/.

## List of documents

To access the list of documents, you'll need to login as `admin:4dm1n` on http://localhost:8000/.
To access the list of documents, you'll need to login as `admin:4dm1n` on http://127.0.0.1:8000/.

## Running tests

Expand Down
123 changes: 62 additions & 61 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,104 @@ name: CI

on:
schedule:
- cron: 0 2 * * 1-5
# Every sunday at 02:00
- cron: 0 2 * * 0
pull_request:
push:
branches:
- v5

env:
COVERAGE: '0'
EXT_PCOV_VERSION: '1.0.6'

jobs:
tests:
name: Tests PHP ${{ matrix.php }} ${{ matrix.dependency }} (Symfony ${{ matrix.symfony }})
runs-on: ubuntu-latest
container:
image: php:${{ matrix.php }}
options: >-
--tmpfs /tmp:exec
strategy:
# https://github.community/t5/GitHub-Actions/GitHub-Actions-Matrix-options-dont-work-as-documented/m-p/29558
matrix:
php:
- '7.2'
- '7.3'
- '7.4'
- 'rc'
symfony:
- '4.4.*'
- '5.0.*'
include:
- php: '7.4'
coverage: true
- '5.1.*'
dependency:
- ''
- 'lowest'
include:
- php: '7.4'
dependency: ''
symfony: '5.1.*'
coverage: true
bootable: true
exclude:
- symfony: '4.4.*'
dependency: 'lowest'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v1

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
path: ~/.composer/cache
key: ${{ matrix.php }}-composer-${{ matrix.dependency }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ matrix.php }}-composer-${{ matrix.dependency }}-
- name: Enable code coverage
if: matrix.coverage && matrix.dependency == ''
run: echo "COVERAGE=1" >> $GITHUB_ENV
php-version: ${{ matrix.php }}
extensions: composer:v2, flex
coverage: pcov
tools: php-cs-fixer

- name: Install system packages
run: |
apt-get update
apt-get install -y --no-install-recommends \
unzip\
libzip-dev \
chromium \
gnupg
docker-php-ext-install zip
- name: Install pcov PHP extension
if: env.COVERAGE == '1'
run: |
pecl install pcov-$EXT_PCOV_VERSION
docker-php-ext-install sockets
docker-php-ext-enable pcov sockets
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install Composer
run: curl -sS -o - https://raw.githubusercontent.com/composer/getcomposer.org/ba13e3fc70f1c66250d1ea7ea4911d593aa1dba5/web/installer | php -- --install-dir=/usr/local/bin --filename=composer --quiet
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Configure Symfony
run: |
composer global require symfony/flex
composer config extra.symfony.require "${{ matrix.symfony }}"
run: composer config extra.symfony.require "${{ matrix.symfony }}"

- name: Update project dependencies
if: matrix.dependency == ''
run: php -d memory_limit=-1 `which composer` update --no-progress --no-suggest --ansi --prefer-stable
run: composer update --no-progress --ansi --prefer-stable ${{ matrix.composer }}

- name: Update project dependencies lowest
if: matrix.dependency == 'lowest'
run: composer update --no-progress --ansi --prefer-lowest --prefer-stable

- name: Disable deprecations notices for lowest dependencies
if: matrix.dependency == 'lowest'
run: echo "SYMFONY_DEPRECATIONS_HELPER=weak" >> $GITHUB_ENV

- name: Bundle is bootable
if: matrix.bootable
env:
SKELETON_VERSION: ${{matrix.symfony}}
run: |
php -d memory_limit=-1 `which composer` remove --dev --no-progress --no-update --ansi league/flysystem-bundle
php -d memory_limit=-1 `which composer` update --no-progress --no-suggest --ansi --prefer-stable --prefer-lowest
composer create-project "symfony/skeleton:${SKELETON_VERSION}" flex
cd flex
composer config extra.symfony.allow-contrib true
composer req --ignore-platform-reqs gheb/docusign-bundle
- name: Run php-cs-fixer tests
if: matrix.php != 'rc'
run: php-cs-fixer fix --diff --dry-run

- name: Install chromium
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends chromium-browser
- name: Run phpstan tests
if: matrix.dependency == ''
run: php -d memory_limit=-1 vendor/bin/phpstan analyze
run: vendor/bin/phpstan analyze

- name: Run phpstan tests lowest
if: matrix.dependency == 'lowest'
run: php -d memory_limit=-1 vendor/bin/phpstan analyze -c phpstan.neon.lowest.dist

- name: Run php-cs-fixer tests
run: vendor/bin/php-cs-fixer fix --dry-run --diff
run: vendor/bin/phpstan analyze -c phpstan.neon.lowest.dist

- name: Prepare PHPUnit tests
env:
Expand All @@ -107,7 +109,7 @@ jobs:
openssl aes-256-cbc -d -a -pbkdf2 -salt -in features/var/jwt/docusign.pem.enc -out features/var/jwt/docusign.pem -pass env:DOCUSIGN_RSA_PASSPHRASE
- name: Run PHPUnit tests with coverage
if: env.COVERAGE == '1'
if: matrix.coverage
env:
DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }}
DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }}
Expand All @@ -119,10 +121,10 @@ jobs:
DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }}
DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }}
DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }}
run: vendor/bin/phpunit --coverage-clover build/logs/phpunit/clover.xml --colors=always --testdox
run: vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --colors=always --testdox

- name: Run PHPUnit tests
if: env.COVERAGE == '0'
if: matrix.coverage == ''
env:
DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }}
DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }}
Expand All @@ -134,27 +136,26 @@ jobs:
DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }}
DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }}
DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }}
run: vendor/bin/phpunit --colors=always --testdox
run: vendor/bin/simple-phpunit --colors=always --testdox

- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v1
with:
name: build-php${{ matrix.php }}
path: build

- name: Upload coverage results to Codecov
if: env.COVERAGE == '1'
if: matrix.coverage
uses: codecov/[email protected]
with:
name: phpunit-php${{ matrix.php }}
flags: phpunit
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload coverage results to Coveralls
if: env.COVERAGE == '1'
if: matrix.coverage
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require --prefer-dist --no-progress --no-suggest --ansi cedx/coveralls
composer global require --prefer-dist --no-progress --ansi cedx/coveralls
$HOME/.composer/vendor/bin/coveralls build/logs/phpunit/clover.xml
2 changes: 1 addition & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ HEADER;

$finder = PhpCsFixer\Finder::create()
->in(__DIR__)
->exclude('features/var');
->exclude(['features', 'flex']);

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
Expand Down
26 changes: 17 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"email": "[email protected]"
},
"require": {
"php": "^7.2",
"php": ">=7.2",
"ext-SimpleXML": "*",
"docusign/esign-client": "^3.0",
"lcobucci/jwt": "^3.3.1",
"lcobucci/jwt": "^3.3.1 || ^4.0-dev",
"league/flysystem": "^1.0.8",
"psr/log": "^1.1",
"symfony/config": "^4.4 || ^5.0",
Expand All @@ -43,24 +43,23 @@
"webmozart/assert": "^1.5"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16.2",
"doctrine/annotations": "^1.11",
"league/flysystem-bundle": "^1.2",
"nyholm/symfony-bundle-test": "^1.6.1",
"phpspec/prophecy": "^1.9",
"nyholm/symfony-bundle-test": "dev-master",
"phpstan/phpstan": "^0.12.18",
"phpunit/phpunit": "^7.5.2 || ^8.0",
"psr/event-dispatcher": "^1.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/css-selector": "^4.4 || ^5.0",
"symfony/debug": "^4.4 || ^5.0",
"symfony/dotenv": "^4.4 || ^5.0",
"symfony/monolog-bundle": "^3.5",
"symfony/panther": "^0.6.1",
"symfony/phpunit-bridge": "^4.4 || ^5.0",
"symfony/polyfill-php72": "^1.9",
"symfony/process": "^4.4 || ^5.0",
"symfony/profiler-pack": "^1.0",
"symfony/security-bundle": "^4.4 || ^5.0",
"symfony/twig-bundle": "^4.4 || ^5.0",
"symfony/web-server-bundle": "^4.4 || ^5.0"
"symfony/twig-bundle": "^4.4 || ^5.0"
},
"suggest": {
"league/flysystem-bundle": "For Symfony >4.2 - Allow the use of the official adapter system instead of the compat layer.",
Expand All @@ -74,9 +73,18 @@
"autoload-dev": {
"psr-4": {
"DocusignBundle\\Tests\\": "tests/",
"DocusignBundle\\E2e\\": "features/"
"DocusignBundle\\E2e\\": "features/src/",
"PHPUnit\\": "vendor/bin/.phpunit/phpunit/src"
}
},
"scripts": {
"post-install-cmd": [
"vendor/bin/simple-phpunit --version"
],
"post-update-cmd": [
"vendor/bin/simple-phpunit --version"
]
},
"config": {
"sort-packages": true
},
Expand Down
Loading

0 comments on commit 3092096

Please sign in to comment.