Skip to content

Commit

Permalink
DevKit updates (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Jan 5, 2022
1 parent c3d3d41 commit 568b4cb
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/symfony-lint.yaml
@@ -0,0 +1,115 @@
# DO NOT EDIT THIS FILE!
#
# It's auto-generated by sonata-project/dev-kit package.

name: Symfony Lint

on:
schedule:
- cron: '30 0 * * *'
push:
branches:
- 1.x
- 2.x
pull_request:

jobs:
container:
name: Symfony container

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Lint container
run: make lint-symfony-container

twig:
name: Twig files

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Lint twig files
run: make lint-symfony-twig

xliff:
name: XLIFF files

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Lint xliff files
run: make lint-symfony-xliff

yaml:
name: YML files

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
tools: composer:v2

- name: Install Composer dependencies (highest)
uses: ramsey/composer-install@v1
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Lint yaml files
run: make lint-symfony-yaml
19 changes: 19 additions & 0 deletions Makefile
Expand Up @@ -47,6 +47,25 @@ lint-php:
php-cs-fixer fix --ansi --verbose --diff --dry-run
.PHONY: lint-php

lint-symfony: lint-symfony-container lint-symfony-twig lint-symfony-xliff lint-symfony-yaml
.PHONY: lint-symfony

lint-symfony-container:
bin/console lint:container
.PHONY: lint-symfony-container

lint-symfony-twig:
bin/console lint:twig src tests
.PHONY: lint-symfony-twig

lint-symfony-xliff:
bin/console lint:xliff src tests
.PHONY: lint-symfony-xliff

lint-symfony-yaml:
bin/console lint:yaml src tests
.PHONY: lint-symfony-yaml

cs-fix: cs-fix-php cs-fix-xml cs-fix-xliff cs-fix-composer
.PHONY: cs-fix

Expand Down
29 changes: 29 additions & 0 deletions bin/console
@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php

declare(strict_types=1);

/*
* This file is part of the Sonata Project package.
*
* (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

use Sonata\Twig\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;

if (!in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true)) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL;
}

set_time_limit(0);

require dirname(__DIR__) . '/vendor/autoload.php';

$kernel = new AppKernel();
$application = new Application($kernel);
$application->run(new ArgvInput());

0 comments on commit 568b4cb

Please sign in to comment.