Update to latest base module

This commit is contained in:
Florian Engelhardt 2021-04-19 13:55:43 +02:00
parent 6d082f7900
commit d85b851af4
No known key found for this signature in database
GPG Key ID: 39B8DAD75A95B500
8 changed files with 120 additions and 96 deletions

51
.github/workflows/CI.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: Ubuntu-20.04
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
DEPENDENCIES: ['', '--prefer-lowest']
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- 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.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Create project
run: composer create-project oxid-esales/graphql-module --repository packages.json --remove-vcs -n --no-plugins
- name: Syntax Test
run: composer test:syntax
working-directory: ./graphql-module
- name: Lint Test
run: composer test:lint
working-directory: ./graphql-module
- name: Static Analyzer
run: composer test:static
working-directory: ./graphql-module
- name: Unit Tests
run: composer test:unit
working-directory: ./graphql-module

45
.github/workflows/CI.yml.dist vendored Normal file
View File

@ -0,0 +1,45 @@
name: CI
on: [push, pull_request]
jobs:
build:
runs-on: Ubuntu-20.04
strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4']
DEPENDENCIES: ['', '--prefer-lowest']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- 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.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install
run: composer install -n --no-plugins $DEPENDENCIES
- name: Syntax Test
run: composer test:syntax
- name: Lint Test
run: composer test:lint
- name: Static Analyzer
run: composer test:static
- name: Unit Tests
run: composer test:unit

View File

@ -3,40 +3,21 @@
declare(strict_types=1); declare(strict_types=1);
$header = <<<'EOF' $header = <<<'EOF'
Copyright © __Vendor__. All rights reserved. Copyright © __Vender__. All rights reserved.
See LICENSE file for license details. See LICENSE file for license details.
EOF; EOF;
$finder = PhpCsFixer\Finder::create() $finder = PhpCsFixer\Finder::create()
->exclude('Codeception/_support/_generated/') ->exclude('Codeception/_support/_generated/')
->in(__DIR__ . '/src') ->in(__DIR__ . '/src')
->in(__DIR__ . '/tests/'); ->in(__DIR__ . '/tests/')
->name('*.stub');
return PhpCsFixer\Config::create() return PhpCsFixer\Config::create()
->setFinder($finder) ->setFinder($finder)
->setRiskyAllowed(true) ->setRiskyAllowed(true)
->setRules([ ->setRules([
'@PSR2' => true, '@PSR12' => true,
'blank_line_after_opening_tag' => true,
'compact_nullable_typehint' => true,
'declare_equal_normalize' => [
'space' => 'none'
],
'function_typehint_space' => true,
'final_class' => true,
'method_argument_space' => [
'on_multiline' => 'ensure_fully_multiline',
],
'new_with_braces' => true,
'no_empty_statement' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_whitespace_in_blank_line' => true,
'return_type_declaration' => [
'space_before' => 'none'
],
'single_trait_insert_per_statement' => true,
'align_multiline_comment' => [ 'align_multiline_comment' => [
'comment_type' => 'all_multiline' 'comment_type' => 'all_multiline'
], ],
@ -91,6 +72,15 @@ return PhpCsFixer\Config::create()
], ],
'declare_strict_types' => true, 'declare_strict_types' => true,
'dir_constant' => true, 'dir_constant' => true,
'final_internal_class' => [
'annotation-white-list' => [],
'consider-absent-docblock-as-internal-class' => true,
'annotation-black-list' => [
'@eshopExtension',
'@dataType-extension',
'@extendable-dataType'
],
],
'global_namespace_import' => [ 'global_namespace_import' => [
'import_classes' => true, 'import_classes' => true,
'import_constants' => true, 'import_constants' => true,

View File

@ -1,29 +0,0 @@
language: php
dist: bionic
notifications:
email: false
php:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
before_script:
- composer create-project oxid-esales/graphql-module --repository packages.json --remove-vcs -n
script:
- cd graphql-module
- composer test:syntax
- composer test:lint
- composer test:static
- composer test:unit

View File

@ -1,28 +0,0 @@
language: php
dist: bionic
notifications:
email: false
php:
- "7.1"
- "7.2"
- "7.3"
- "7.4"
cache:
directories:
- $HOME/.composer/cache/files
matrix:
fast_finish: true
before_script:
- composer install --prefer-dist
script:
- composer test:syntax
- composer test:lint
- composer test:static
- composer test:unit

View File

@ -11,11 +11,11 @@
}, },
"require": { "require": {
"php": "^7.1", "php": "^7.1",
"oxid-esales/graphql-base": "^3.1.3" "oxid-esales/graphql-base": "^5.1.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^7.5.20|^8.5|^9", "phpunit/phpunit": "^7.5.20|^8.5|^9",
"friendsofphp/php-cs-fixer": "^2.16.4", "friendsofphp/php-cs-fixer": "^2.18.2",
"php-parallel-lint/php-parallel-lint": "^1.1", "php-parallel-lint/php-parallel-lint": "^1.1",
"phpstan/phpstan": "^0.12.26", "phpstan/phpstan": "^0.12.26",
"oxid-esales/oxideshop-ce": "^6.5", "oxid-esales/oxideshop-ce": "^6.5",
@ -28,12 +28,6 @@
} }
}, },
"scripts": { "scripts": {
"pre-install-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::preInstall"
],
"pre-update-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::preInstall"
],
"post-create-project-cmd": [ "post-create-project-cmd": [
"OxidEsales\\GraphQL\\Skeleton\\Installer::postInstall", "OxidEsales\\GraphQL\\Skeleton\\Installer::postInstall",
"composer update", "composer update",

View File

@ -5,7 +5,7 @@
"source": { "source": {
"url": "./", "url": "./",
"type": "git", "type": "git",
"reference": "master" "reference": "master-upgrade-to-latests-base"
} }
} }
} }

View File

@ -15,6 +15,10 @@ class Installer
private static $packageName; private static $packageName;
public static function preInstall(Event $event): void public static function preInstall(Event $event): void
{
}
public static function postInstall(Event $event = null): void
{ {
$io = $event->getIO(); $io = $event->getIO();
$vendor = self::ask($io, 'What is the vendor?', 'MyVendor'); $vendor = self::ask($io, 'What is the vendor?', 'MyVendor');
@ -26,10 +30,9 @@ class Installer
// Update composer definition // Update composer definition
$json->write($composerDefinition); $json->write($composerDefinition);
$io->write("<info>composer.json for {$composerDefinition['name']} is created.\n</info>"); $io->write("<info>composer.json for {$composerDefinition['name']} is created.\n</info>");
}
public static function postInstall(Event $event = null): void
{
unset($event); unset($event);
list($vendor, $package, $packageFull) = self::$packageName; list($vendor, $package, $packageFull) = self::$packageName;
$skeletonRoot = dirname(__DIR__); $skeletonRoot = dirname(__DIR__);
@ -37,10 +40,9 @@ class Installer
// remove installer files // remove installer files
unlink($skeletonRoot.'/README.md'); unlink($skeletonRoot.'/README.md');
unlink($skeletonRoot.'/LICENSE'); unlink($skeletonRoot.'/LICENSE');
unlink($skeletonRoot.'/.travis.yml');
unlink($skeletonRoot.'/packages.json'); unlink($skeletonRoot.'/packages.json');
rename($skeletonRoot.'/README.md.dist', $skeletonRoot.'/README.md'); rename($skeletonRoot.'/README.md.dist', $skeletonRoot.'/README.md');
rename($skeletonRoot.'/.travis.yml.dist', $skeletonRoot.'/.travis.yml'); rename($skeletonRoot.'/.github/workflows/CI.yml.dist', $skeletonRoot.'/.github/workflows/CI.yml');
unlink(__FILE__); unlink(__FILE__);
} }
@ -74,8 +76,7 @@ class Installer
unset( unset(
$composerDefinition['autoload']['files'], $composerDefinition['autoload']['files'],
$composerDefinition['scripts']['pre-install-cmd'], $composerDefinition['scripts']['pre-install-cmd'],
$composerDefinition['scripts']['pre-update-cmd'], $composerDefinition['scripts']['post-install-cmd'],
$composerDefinition['scripts']['post-create-project-cmd'],
$composerDefinition['homepage'] $composerDefinition['homepage']
); );