Skip to content

Commit

Permalink
Support Symfony 6.0 + test with it and PHP 8.1 (#126)
Browse files Browse the repository at this point in the history
Co-authored-by: Grégoire Hébert <gregoire@les-tilleuls.coop>
  • Loading branch information
vincentchalamon and GregoireHebert committed Jan 17, 2022
1 parent 0bc143d commit 652ecf0
Show file tree
Hide file tree
Showing 36 changed files with 305 additions and 240 deletions.
2 changes: 0 additions & 2 deletions .github/CONTRIBUTING.md
Expand Up @@ -133,7 +133,6 @@ return [

Then, you must define the following urls in the `Redirect URIs` section on DocuSign Admin:

https://127.0.0.1:8000
https://127.0.0.1:8000
https://127.0.0.1:8000/docusign/authorization_code/embedded_auth_code
https://127.0.0.1:8000/docusign/authorization_code/remote_auth_code
Expand Down Expand Up @@ -163,7 +162,6 @@ To access the list of documents, you'll need to login as `admin:4dm1n` on http:/

You must add the following urls in the `Redirect URIs` section on DocuSign Admin:

http://127.0.0.1:9080
http://127.0.0.1:9080
http://127.0.0.1:9080/docusign/authorization_code/embedded_auth_code
http://127.0.0.1:9080/docusign/authorization_code/remote_auth_code
Expand Down
57 changes: 35 additions & 22 deletions .github/workflows/ci.yml
Expand Up @@ -5,7 +5,10 @@ on:
# Every sunday at 02:00
- cron: 0 2 * * 0
pull_request:
push: ~
push:
branches:
- main
- '[0-9].x'

jobs:
tests:
Expand All @@ -17,22 +20,34 @@ jobs:
- '7.3'
- '7.4'
- '8.0'
- '8.1'
symfony:
- '4.4.*'
- '5.3.*'
- '5.4.*'
- '6.0.*'
dependency:
- ''
- '--prefer-lowest'
exclude:
- symfony: '6.0.*'
php: '7.3'
- symfony: '6.0.*'
php: '7.4'
- symfony: '5.4.*'
dependency: '--prefer-lowest'
- symfony: '6.0.*'
dependency: '--prefer-lowest'
include:
- php: '7.4'
dependency: ''
symfony: '5.3.*'
symfony: '5.4.*'
bootable: true
- php: '8.0'
- php: '8.1'
dependency: ''
symfony: '5.3.*'
coverage: true
symfony: '6.0.*'
coverage: '--coverage-clover build/logs/phpunit/clover.xml'
bootable: true
quality: true
fail-fast: false
steps:
- name: Checkout
Expand Down Expand Up @@ -68,35 +83,31 @@ jobs:
run: composer update --no-progress --ansi --prefer-stable ${{ matrix.dependency }}

- name: Bundle is bootable
if: ${{ matrix.bootable && github.event_name == 'push' }}
if: matrix.bootable && github.event_name == 'push'
env:
SKELETON_VERSION: ${{matrix.symfony}}
SKELETON_VERSION: ${{ matrix.symfony }}
run: |
composer create-project "symfony/skeleton:${SKELETON_VERSION}" flex
cd flex
composer config extra.symfony.allow-contrib true
composer req gheb/docusign-bundle:dev-${GITHUB_REF#refs/heads/}
- name: Run php-cs-fixer tests
if: matrix.quality
run: php-cs-fixer fix --diff --dry-run

- name: Run phpstan tests
if: matrix.dependency == '' && matrix.php == '7.4'
if: matrix.quality
run: vendor/bin/phpstan analyze

- name: Run phpstan tests lowest
if: matrix.dependency != '' && matrix.php == '7.4'
run: vendor/bin/phpstan analyze -c phpstan.neon.lowest.dist

- name: Prepare PHPUnit tests
env:
DOCUSIGN_RSA_PASSPHRASE: ${{ secrets.DOCUSIGN_RSA_PASSPHRASE }}
run: |
mkdir -p build/screenshots build/logs/phpunit
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: matrix.coverage
- name: Run PHPUnit tests
env:
DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }}
DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }}
Expand All @@ -108,10 +119,9 @@ jobs:
DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }}
DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }}
DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }}
run: vendor/bin/simple-phpunit --coverage-clover build/logs/phpunit/clover.xml --colors=always --testdox
run: vendor/bin/simple-phpunit ${{ matrix.coverage }}

- name: Run PHPUnit tests
if: matrix.coverage == ''
- name: Run bootable PHPUnit tests
env:
DOCUSIGN_INTEGRATION_KEY: ${{ secrets.DOCUSIGN_INTEGRATION_KEY }}
DOCUSIGN_USER_GUID: ${{ secrets.DOCUSIGN_USER_GUID }}
Expand All @@ -123,24 +133,27 @@ jobs:
DOCUSIGN_DEFAULT_SIGNER_EMAIL: ${{ secrets.DOCUSIGN_DEFAULT_SIGNER_EMAIL }}
DOCUSIGN_EMAIL: ${{ secrets.DOCUSIGN_EMAIL }}
DOCUSIGN_PASSWORD: ${{ secrets.DOCUSIGN_PASSWORD }}
run: vendor/bin/simple-phpunit --colors=always --testdox
run: |
composer require --dev nyholm/symfony-bundle-test:dev-master
vendor/bin/simple-phpunit --group bootable
- name: Upload test artifacts
- name: Upload coverage artifacts
if: matrix.coverage != ''
uses: actions/upload-artifact@v1
with:
name: build-php${{ matrix.php }}
path: build

- name: Upload coverage results to Codecov
if: matrix.coverage
if: matrix.coverage != ''
uses: codecov/codecov-action@v1.0.3
with:
name: phpunit-php${{ matrix.php }}
flags: phpunit
token: ${{ secrets.CODECOV_TOKEN }}

- name: Upload coverage results to Coveralls
if: matrix.coverage
if: matrix.coverage != ''
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -13,3 +13,4 @@
!features/var/storage/dummy.pdf
/completed.pdf
/drivers/
/screenshots/
50 changes: 39 additions & 11 deletions .php-cs-fixer.dist.php
Expand Up @@ -11,9 +11,9 @@
file that was distributed with this source code.
HEADER;

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

return (new PhpCsFixer\Config())
Expand All @@ -26,7 +26,7 @@
'@Symfony' => true,
'@Symfony:risky' => true,
'align_multiline_comment' => [
'comment_type' => 'phpdocs_only',
'comment_type' => 'phpdocs_like',
],
'array_indentation' => true,
'array_syntax' => [
Expand All @@ -43,6 +43,18 @@
'after_array_assignments_equals' => false,
'before_array_assignments_equals' => false,
],
'explicit_indirect_variable' => true,
'fully_qualified_strict_types' => true,
'header_comment' => [
'header' => $header,
'location' => 'after_open',
],
'logical_operators' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => [
'strategy' => 'no_multi_line',
],
'no_alternative_syntax' => true,
'no_extra_blank_lines' => [
'tokens' => [
'break',
Expand All @@ -56,7 +68,12 @@
'use',
],
],
'no_superfluous_phpdoc_tags' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => false,
],
'no_unset_cast' => true,
'no_unset_on_property' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => [
Expand All @@ -70,16 +87,27 @@
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_test_annotation' => [
'style' => 'prefix',
],
'phpdoc_add_missing_param_annotation' => [
'only_untyped' => true,
],
'phpdoc_no_alias_tag' => true,
'phpdoc_order' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_var_annotation_correct_order' => true,
'return_assignment' => true,
'strict_comparison' => true,
'strict_param' => true,
'void_return' => true,
'header_comment' => [
'header' => $header,
'location' => 'after_open',
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
'void_return' => true,
])
->setFinder($finder)
->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line
;
->setFinder($finder);
48 changes: 24 additions & 24 deletions composer.json
Expand Up @@ -25,43 +25,43 @@
"require": {
"php": ">=7.2",
"ext-SimpleXML": "*",
"docusign/esign-client": "^3.0",
"docusign/esign-client": "^5.0 || ^6.0",
"lcobucci/jwt": "^3.3.1 || ^4.0",
"league/flysystem": "^1.1 || ^2.3",
"psr/log": "^1.1 || ^2.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/event-dispatcher-contracts": "^1.0 || ^2.0",
"symfony/http-client": "^4.4 || ^5.0",
"symfony/http-foundation": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.1.5",
"symfony/options-resolver": "^4.4 || ^5.0",
"symfony/routing": "^4.4 || ^5.0",
"symfony/stopwatch": "^4.4 || ^5.0",
"symfony/translation": "^4.4 || ^5.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.0 || ^6.0",
"symfony/event-dispatcher-contracts": "^1.0 || ^2.0 || ^3.0",
"symfony/http-client": "^4.4 || ^5.0 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.0 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.1.5 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0",
"symfony/routing": "^4.4 || ^5.0 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.0 || ^6.0",
"symfony/translation": "^4.4 || ^5.0 || ^6.0",
"vgrem/php-spo": "^2.2",
"webmozart/assert": "^1.5"
},
"require-dev": {
"dbrekelmans/bdi": "^0.3.0",
"dbrekelmans/bdi": "^1.0",
"doctrine/annotations": "^1.11",
"league/flysystem-bundle": "^1.2 || ^2.0",
"nyholm/symfony-bundle-test": "^1.8",
"phpspec/prophecy": "^1.12",
"phpstan/phpstan": "^0.12.66",
"phpstan/phpstan": "^1.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/console": "^4.4 || ^5.0 || ^6.0",
"symfony/css-selector": "^4.4 || ^5.0 || ^6.0",
"symfony/debug": "^4.4",
"symfony/dotenv": "^4.4 || ^5.0 || ^6.0",
"symfony/monolog-bundle": "^3.5",
"symfony/panther": "^1.0",
"symfony/phpunit-bridge": "^5.1",
"symfony/panther": "^1.0 || ^2.0",
"symfony/phpunit-bridge": "^5.1 || ^6.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/process": "^4.4 || ^5.0 || ^6.0",
"symfony/security-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/twig-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/web-profiler-bundle": "^4.4 || ^5.0 || ^6.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0"
},
"suggest": {
"league/flysystem-bundle": "For Symfony >4.2 - Allow the use of the official adapter system instead of the compat layer.",
Expand Down
4 changes: 2 additions & 2 deletions features/bootstrap.php
Expand Up @@ -17,7 +17,7 @@

// PHPUnit's autoloader
if (!file_exists($phpUnitAutoloaderPath = __DIR__.'/../vendor/bin/.phpunit/phpunit/vendor/autoload.php')) {
die('PHPUnit is not installed. Please run vendor/bin/simple-phpunit --version to install it');
exit('PHPUnit is not installed. Please run vendor/bin/simple-phpunit --version to install it');
}

$phpunitLoader = require $phpUnitAutoloaderPath;
Expand Down Expand Up @@ -45,4 +45,4 @@
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
6 changes: 3 additions & 3 deletions features/config/override.yaml
@@ -1,4 +1,4 @@
services:
test.docusign.token_encoder.default:
parent: docusign.token_encoder.default
public: true
test.docusign.token_encoder.default:
parent: docusign.token_encoder.default
public: true
4 changes: 2 additions & 2 deletions features/config/routes/annotations.yaml
@@ -1,3 +1,3 @@
controllers:
resource: ../../src/Controller/
type: annotation
resource: ../../src/Controller/
type: annotation
12 changes: 6 additions & 6 deletions features/config/routes/debug.yaml
@@ -1,11 +1,11 @@
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt

web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
4 changes: 2 additions & 2 deletions features/config/routes/docusign.yaml
@@ -1,3 +1,3 @@
docusign:
resource: .
type: docusign
resource: .
type: docusign

0 comments on commit 652ecf0

Please sign in to comment.