From 5b9cec6e6e2e16b43c691aa7f4139b0af81f98af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Noco=C5=84?= Date: Tue, 26 Apr 2022 09:29:20 +0200 Subject: [PATCH] [CI] Moved to GitHub actions (#44) * [CI] Moved to Github Actions * [CS] Switched to ezsystems/ezplatform-code-style package and config * [CS] Removed strict types rule * [CS] Fixed CS --- .github/workflows/ci.yaml | 68 +++++++++++++++++++ .gitignore | 2 +- .php-cs-fixer.php | 18 +++++ .php_cs | 32 --------- .travis.yml | 26 ------- bundle/DataCollector/TwigDataCollector.php | 9 +-- .../Compiler/AssetPathResolutionPass.php | 7 +- .../Compiler/AssetThemePass.php | 7 +- .../Compiler/PHPStormPass.php | 7 +- .../Compiler/TwigThemePass.php | 7 +- bundle/DependencyInjection/Configuration.php | 7 +- .../DesignConfigParser.php | 7 +- .../EzPlatformDesignEngineExtension.php | 11 ++- bundle/EzPlatformDesignEngineBundle.php | 7 +- composer.json | 7 +- lib/Asset/AssetPathProvisionerInterface.php | 7 +- lib/Asset/AssetPathResolver.php | 9 +-- lib/Asset/AssetPathResolverInterface.php | 7 +- lib/Asset/ProvisionedPathResolver.php | 7 +- lib/Asset/ThemePackage.php | 9 +-- lib/DesignAwareInterface.php | 7 +- lib/DesignAwareTrait.php | 9 +-- lib/Exception/InvalidDesignException.php | 7 +- .../TemplateNameResolverInterface.php | 7 +- lib/Templating/TemplatePathRegistry.php | 7 +- .../TemplatePathRegistryInterface.php | 7 +- lib/Templating/ThemeTemplateNameResolver.php | 9 +-- lib/Templating/Twig/TwigThemeLoader.php | 13 ++-- tests/bootstrap.php | 4 ++ tests/lib/Asset/AssetPathResolverTest.php | 9 +-- .../lib/Asset/ProvisionedPathResolverTest.php | 9 +-- tests/lib/Asset/ThemePackageTest.php | 7 +- .../Templating/TemplatePathRegistryTest.php | 7 +- .../ThemeTemplateNameResolverTest.php | 9 +-- 34 files changed, 163 insertions(+), 209 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .php-cs-fixer.php delete mode 100644 .php_cs delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..9565d64 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,68 @@ +name: CI + +on: + push: + branches: + - main + - '[0-9]+.[0-9]+' + pull_request: ~ + +jobs: + cs-fix: + name: Run code style check + runs-on: "ubuntu-20.04" + strategy: + matrix: + php: + - '7.4' + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: 'pdo_sqlite, gd' + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + + - name: Run code style check + run: composer run-script check-cs -- --format=checkstyle | cs2pr + + tests: + name: Unit tests + runs-on: "ubuntu-20.04" + timeout-minutes: 15 + + strategy: + fail-fast: false + matrix: + php: + - '7.1' + - '7.3' + - '7.4' + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP Action + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: none + extensions: pdo_sqlite, gd + tools: cs2pr + + - uses: "ramsey/composer-install@v1" + with: + dependency-versions: "highest" + + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Run unit test suite + run: composer test diff --git a/.gitignore b/.gitignore index 3452648..266ee42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ /vendor/ composer.lock -.php_cs.cache +.php-cs-fixer.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php new file mode 100644 index 0000000..6ee446b --- /dev/null +++ b/.php-cs-fixer.php @@ -0,0 +1,18 @@ +withRules([ + 'declare_strict_types' => false, +]); + +return $configFactory->buildConfig() + ->setFinder( + PhpCsFixer\Finder::create() + ->in([ + __DIR__ . '/lib', + __DIR__ . '/bundle', + __DIR__ . '/tests', + ]) + ->files()->name('*.php') + ); diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 054baa8..0000000 --- a/.php_cs +++ /dev/null @@ -1,32 +0,0 @@ -setRules([ - '@Symfony' => true, - '@Symfony:risky' => true, - 'concat_space' => ['spacing' => 'one'], - 'array_syntax' => false, - 'simplified_null_return' => false, - 'phpdoc_align' => false, - 'phpdoc_separation' => false, - 'phpdoc_to_comment' => false, - 'cast_spaces' => false, - 'blank_line_after_opening_tag' => false, - 'single_blank_line_before_namespace' => false, - 'phpdoc_annotation_without_dot' => false, - 'phpdoc_no_alias_tag' => false, - 'space_after_semicolon' => false, - 'yoda_style' => false, - 'no_break_comment' => false, - ]) - ->setRiskyAllowed(true) - ->setFinder( - PhpCsFixer\Finder::create() - ->in(__DIR__) - ->exclude([ - 'vendor', - 'doc', - ]) - ->files()->name('*.php') - ) -; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e6038ca..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -language: php - -cache: - directories: - - $HOME/.composer/cache - -matrix: - include: - - php: 5.6 - - php: 7.0 - - php: 7.1 - env: FIX_CS=true - -branches: - only: - - master - - /^\d+\.\d+$/ - -install: - - phpenv config-rm xdebug.ini - - echo 'memory_limit = -1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - - composer install - -script: - - vendor/bin/phpunit - - if [ "$FIX_CS" == "true" ]; then vendor/bin/php-cs-fixer fix -v --dry-run --diff --show-progress=estimating; fi diff --git a/bundle/DataCollector/TwigDataCollector.php b/bundle/DataCollector/TwigDataCollector.php index c74ba22..20885ef 100644 --- a/bundle/DataCollector/TwigDataCollector.php +++ b/bundle/DataCollector/TwigDataCollector.php @@ -1,12 +1,9 @@