Skip to content

Commit

Permalink
Merge pull request #572 from schmittjoh/actions
Browse files Browse the repository at this point in the history
Use github actions ci
  • Loading branch information
goetas authored Jan 7, 2023
2 parents bf2628f + 3adddc2 commit 619e880
Show file tree
Hide file tree
Showing 17 changed files with 177 additions and 121 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# yamllint disable rule:line-length
# yamllint disable rule:braces

name: CI

on:
pull_request:
push:
branches:
- "master"

jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"

strategy:
fail-fast: false
matrix:
symfony-version:
- '^4.4'
- '^5.4'
php-version:
- "7.4"
- "8.0"
- "8.1"
dependencies:
- "lowest"
- "highest"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"

- name: Configure symfony version
uses: php-actions/composer@v6
with:
command: config
args: extra.symfony.require ${{ matrix.symfony-version }}

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"
composer-options: "${{ matrix.composer-options }}"

- name: Run tests
run: |
SYMFONY_DEPRECATIONS_HELPER=weak vendor/bin/simple-phpunit ${PHPUNIT_FLAGS}
35 changes: 35 additions & 0 deletions .github/workflows/coding-standards.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "Coding Standards"

on:
pull_request:
push:
branches:
- "master"

jobs:
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-20.04"

strategy:
matrix:
php-version:
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
php-version: "${{ matrix.php-version }}"
tools: "cs2pr"
extensions: pdo_sqlite

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"

- name: "Run PHP_CodeSniffer"
run: "vendor/bin/phpcs"
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,38 @@ vendor/
.phpunit.result.cache
.phpcs-cache
phpcs.xml


/bin/
/config/
/public/
/src/
/templates
/tests
/translations
/var/
/.env*
/.phpunit.result.cache

.idea/
/symfony.lock

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
###< squizlabs/php_codesniffer ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/install_cs.sh

This file was deleted.

9 changes: 0 additions & 9 deletions .travis/install_test.sh

This file was deleted.

5 changes: 0 additions & 5 deletions .travis/script_cs.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .travis/script_test.sh

This file was deleted.

6 changes: 0 additions & 6 deletions .travis/success_test.sh

This file was deleted.

8 changes: 4 additions & 4 deletions Tests/Functional/Controller/ApiControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,13 @@ public function testUpdateAction()
$this->assertTrue($written !== false && $written > 0);

$client->request('POST', '/_trans/api/configs/app/domains/navigation/locales/en/messages?id=main.home', ['_method' => 'PUT', 'message' => 'Away']);

$fileContent = is_file($file) ? file_get_contents($file) : '';
unlink($file);
$this->assertEquals(200, $client->getResponse()->getStatusCode());

// Verify that the file has new content
$array = Yaml::parse(file_get_contents($file));
$array = Yaml::parse($fileContent);

if ($isSf4) {
$this->assertTrue(isset($array['main.home']), print_r($array, true));
Expand All @@ -40,8 +43,5 @@ public function testUpdateAction()
$this->assertTrue(isset($array['main']['home']));
$this->assertEquals('Away', $array['main']['home']);
}

// Remove the file
unlink($file);
}
}
3 changes: 2 additions & 1 deletion Tests/Functional/config/framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ framework:
storage_id: session.storage.mock_file
form: true
csrf_protection: true
annotations: true
property_access: true
validation:
enabled: true
enable_annotations: true
translator:
enabled: true
router:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Functional/config/routing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ JMSTranslationBundle_ui:

TestBundle:
type: annotation
resource: "@TestBundle/Controller/"
resource: "@TestBundle/Controller/"
4 changes: 3 additions & 1 deletion Tests/Translation/Extractor/File/Fixture/MyFormModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class MyFormModel implements TranslationContainerInterface
'bar' => 'form.label.choice.bar',
];

/** @Assert\NotBlank(message = "form.error.name_required") */
/**
* @Assert\NotBlank(message = "form.error.name_required")
*/
public $name;

public static function getTranslationMessages()
Expand Down
2 changes: 1 addition & 1 deletion Translation/Extractor/File/DefaultPhpFileExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function enterNode(Node $node)
$index = $this->methodsToExtractFrom[strtolower($methodCallNodeName)];
$domainArg = null;

if (isset($node->args[$index]) && $node->args[$index] instanceof Node\Arg && null === $node->args[$index]->name ) {
if (isset($node->args[$index]) && $node->args[$index] instanceof Node\Arg && null === $node->args[$index]->name) {
$domainArg = $node->args[$index];
} else {
foreach ($node->args as $arg) {
Expand Down
1 change: 1 addition & 0 deletions Translation/Loader/XliffLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private function libxmlDisableEntityLoader(bool $disable): bool
return true;
}

// phpcs:ignore
return libxml_disable_entity_loader($disable);
}
}
58 changes: 37 additions & 21 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,61 @@
}
],
"require": {
"php": "^7.2 || ^8.0",
"php": "^7.4 || ^8.0",
"nikic/php-parser": "^4.9",
"symfony/console": "^3.4 || ^4.3 || ^5.0",
"symfony/expression-language": "^3.4 || ^4.3 || ^5.0",
"symfony/framework-bundle": "^3.4.31 || ^4.3 || ^5.0",
"symfony/translation": "^3.4 || ^4.3 || ^5.0",
"symfony/console": "^4.3 || ^5.4",
"symfony/expression-language": "^4.3 || ^5.4",
"symfony/framework-bundle": "^4.3 || ^5.4",
"symfony/translation": "^4.3 || ^5.4",
"symfony/translation-contracts": "^1.1 || ^2.0",
"symfony/validator": "^3.4 || ^4.3 || ^5.0",
"symfony/validator": "^4.3 || ^5.4",
"twig/twig": "^1.42.4 || ^2.12.5 || ^3.0"
},
"require-dev": {
"doctrine/annotations": "^1.8",
"doctrine/coding-standard": "^8.0",
"doctrine/annotations": "^1.11",
"doctrine/coding-standard": "^8.2.1",
"matthiasnoback/symfony-dependency-injection-test": "^4.1",
"nyholm/nsa": "^1.0.1",
"phpunit/phpunit": "^8.3",
"symfony/phpunit-bridge": ">=5.4",
"psr/log": "^1.0",
"sensio/framework-extra-bundle": "^5.4",
"symfony/asset": "^3.4 || ^4.3 || ^5.0",
"symfony/browser-kit": "^3.4 || ^4.3 || ^5.0",
"symfony/css-selector": "^3.4 || ^4.3 || ^5.0",
"symfony/filesystem": "^3.4 || ^4.3 || ^5.0",
"symfony/form": "^3.4 || ^4.3 || ^5.0",
"symfony/security-csrf": "^3.4 || ^4.3 || ^5.0",
"symfony/templating": "^3.4 || ^4.3 || ^5.0",
"symfony/twig-bundle": "^3.4.37 || ^4.3.11 || ^5.0"
"sensio/framework-extra-bundle": "^5.5.4",
"symfony/asset": "^4.3 || ^5.4",
"symfony/browser-kit": "^4.3 || ^5.4",
"symfony/css-selector": "^4.3 || ^5.4",
"symfony/filesystem": "^4.3 || ^5.4",
"symfony/form": "^4.3 || ^5.4",
"symfony/security-csrf": "^4.3 || ^5.4",
"symfony/templating": "^4.3 || ^5.4",
"symfony/property-access": "^4.3 || ^5.4",
"symfony/routing": "^4.4.15 || ^5.4",
"symfony/twig-bundle": "^4.3.11 || ^5.4",
"symfony/flex": "^1.19 || ^2.0"
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"symfony/flex": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"extra": {
"branch-alias": {
"dev-master": "1.6-dev"
"dev-master": "1.7-dev"
},
"symfony": {
"allow-contrib": true,
"require": "^5.4"
}
},
"autoload": {
"psr-4": {
"JMS\\TranslationBundle\\": ""
}
},
"minimum-stability": "stable"
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
}
}
}
1 change: 1 addition & 0 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<arg name="extensions" value="php"/>
<arg name="parallel" value="80"/>
<arg name="cache" value=".phpcs-cache"/>
<config name="php_version" value="70400"/>
<arg name="colors"/>

<!-- Ignore warnings, show progress of the run and show sniff names -->
Expand Down

0 comments on commit 619e880

Please sign in to comment.