Skip to content

Commit b38026e

Browse files
Nyholmbocharsky-bw
andauthored
Adding github actions (#429)
* Adding github actions * Remove phpunit/phpunit * Update baselines * Drop 7.1 * Updated meta files * minors * Apply PHP CS Fixer changes * Bugfix Co-authored-by: bocharsky-bw <[email protected]>
1 parent d2e487a commit b38026e

21 files changed

+368
-128
lines changed

Diff for: .gitattributes

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
.github export-ignore
44
.gitignore export-ignore
55
.php_cs export-ignore
6-
.scrutinizer.yml export-ignore
7-
.styleci.yml export-ignore
8-
.travis.yml export-ignore
9-
phpstan.neon.dist export-ignore
6+
phpstan.neon.dist export-ignore
7+
phpstan-baseline.neon export-ignore
8+
psalm.baseline.xml export-ignore
9+
psalm.xml export-ignore
1010
Tests export-ignore

Diff for: .github/workflows/ci.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Test
9+
runs-on: Ubuntu-20.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
php: [ '7.2', '7.3', '7.4', '8.0' ]
14+
strategy: [ 'highest' ]
15+
sf_version: ['']
16+
include:
17+
- php: 7.4
18+
strategy: 'lowest'
19+
- php: 7.3
20+
sf_version: '3.*'
21+
- php: 7.3
22+
sf_version: '4.*'
23+
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v2
27+
28+
- name: Set up PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
php-version: ${{ matrix.php }}
32+
coverage: none
33+
tools: flex
34+
35+
- name: Download dependencies
36+
uses: ramsey/composer-install@v1
37+
env:
38+
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
39+
with:
40+
dependency-versions: ${{ matrix.strategy }}
41+
composer-options: --no-interaction --prefer-dist --optimize-autoloader
42+
43+
- name: Install PHPUnit
44+
run: ./vendor/bin/simple-phpunit install
45+
46+
- name: Run tests
47+
run: ./vendor/bin/simple-phpunit
48+

Diff for: .github/workflows/static.yml

+86-10
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,99 @@ name: Static code analysis
22

33
on: [pull_request]
44

5+
56
jobs:
67
phpstan:
78
name: PHPStan
8-
runs-on: ubuntu-latest
9+
runs-on: Ubuntu-20.04
10+
911
steps:
10-
- uses: actions/checkout@master
11-
- name: Run PHPStan
12-
uses: docker://jakzal/phpqa:php7.3-alpine
12+
- name: Checkout code
13+
uses: actions/checkout@v2
14+
15+
- name: Cache PHPStan
16+
uses: actions/cache@v2
17+
with:
18+
path: .github/.cache/phpstan/
19+
key: phpstan-${{ github.sha }}
20+
restore-keys: phpstan-
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: '7.4'
26+
coverage: none
27+
28+
- name: Download dependencies
29+
uses: ramsey/composer-install@v1
1330
with:
14-
args: phpstan analyze
31+
composer-options: --no-interaction --prefer-dist --optimize-autoloader
32+
33+
- name: Download PHPStan
34+
run: composer bin phpstan update --no-interaction --no-progress
35+
36+
- name: Execute PHPStan
37+
run: vendor/bin/phpstan analyze --no-progress
1538

1639
php-cs-fixer:
1740
name: PHP-CS-Fixer
18-
runs-on: ubuntu-latest
41+
runs-on: Ubuntu-20.04
42+
1943
steps:
20-
- uses: actions/checkout@master
21-
- name: Run PHP-CS-Fixer
22-
uses: docker://jakzal/phpqa:php7.3-alpine
44+
- name: Checkout code
45+
uses: actions/checkout@v2
46+
47+
- name: Cache PhpCsFixer
48+
uses: actions/cache@v2
2349
with:
24-
args: php-cs-fixer fix --dry-run --diff-format udiff -vvv
50+
path: .github/.cache/php-cs-fixer/
51+
key: php-cs-fixer-${{ github.sha }}
52+
restore-keys: php-cs-fixer-
53+
54+
- name: Setup PHP
55+
uses: shivammathur/setup-php@v2
56+
with:
57+
php-version: '7.4'
58+
coverage: none
59+
60+
- name: Download dependencies
61+
uses: ramsey/composer-install@v1
62+
with:
63+
composer-options: --no-interaction --prefer-dist --optimize-autoloader
64+
65+
- name: Download PHP CS Fixer
66+
run: composer bin php-cs-fixer update --no-interaction --no-progress
67+
68+
- name: Execute PHP CS Fixer
69+
run: vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run
70+
71+
psalm:
72+
name: Psalm
73+
runs-on: Ubuntu-20.04
74+
steps:
75+
- name: Checkout code
76+
uses: actions/checkout@v2
77+
78+
- name: Cache Psalm
79+
uses: actions/cache@v2
80+
with:
81+
path: .github/.cache/psalm/
82+
key: psalm-${{ github.sha }}
83+
restore-keys: psalm-
84+
85+
- name: Setup PHP
86+
uses: shivammathur/setup-php@v2
87+
with:
88+
php-version: '7.4'
89+
coverage: none
90+
91+
- name: Download dependencies
92+
uses: ramsey/composer-install@v1
93+
with:
94+
composer-options: --no-interaction --prefer-dist --optimize-autoloader
95+
96+
- name: Download Psalm
97+
run: composer bin psalm update --no-interaction --no-progress
98+
99+
- name: Execute Psalm
100+
run: vendor/bin/psalm --no-progress --output-format=github

Diff for: .scrutinizer.yml

-9
This file was deleted.

Diff for: .travis.yml

-63
This file was deleted.

Diff for: Changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release.
44

5+
## Unreleased
6+
7+
### Removed
8+
9+
- Support for PHP 7.1
10+
511
## 0.12.1
612

713
### Fixed

Diff for: Command/DownloadCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7575
$message = 'The --cache option is deprecated as it\'s now the default behaviour of this command.';
7676

7777
$io->note($message);
78-
@\trigger_error($message, E_USER_DEPRECATED);
78+
@\trigger_error($message, \E_USER_DEPRECATED);
7979
}
8080

8181
$configName = $input->getArgument('configuration');

Diff for: Controller/WebUIController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ private function validateMessage(MessageInterface $message, array $validationGro
271271
{
272272
$errors = $this->validator->validate($message, null, $validationGroups);
273273
if (\count($errors) > 0) {
274-
throw MessageValidationException::create();
274+
throw MessageValidationException::create();
275275
}
276276
}
277277
}

Diff for: Makefile

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
.PHONY: ${TARGETS}
22

3-
DIR := ${CURDIR}
4-
QA_IMAGE := jakzal/phpqa:php7.3-alpine
3+
# https://www.gnu.org/software/make/manual/html_node/Force-Targets.html
4+
always:
55

6-
cs-fix:
7-
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff -vvv
6+
cs-fix: vendor
7+
vendor/bin/php-cs-fixer fix --diff-format udiff -vvv
88

9-
cs-diff:
10-
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) php-cs-fixer fix --diff-format udiff --dry-run -vvv
9+
cs-diff: vendor
10+
vendor/bin/php-cs-fixer fix --diff-format udiff --dry-run -vvv
1111

12-
phpstan:
13-
@docker run --rm -v $(DIR):/project -w /project $(QA_IMAGE) phpstan analyze
12+
phpstan: vendor
13+
vendor/bin/phpstan analyze
1414

15-
phpunit:
15+
psalm: vendor
16+
vendor/bin/psalm
17+
18+
phpunit: vendor
1619
@vendor/bin/phpunit
1720

21+
.PHONY: baseline
22+
baseline: vendor ## Generate baseline files
23+
vendor/bin/phpstan analyze --generate-baseline
24+
vendor/bin/psalm --set-baseline=psalm.baseline.xml
25+
1826
static: cs-diff phpstan
1927

2028
test: static phpunit
29+
30+
vendor: always
31+
composer update --no-interaction
32+
composer bin all install --no-interaction
33+
vendor/bin/simple-phpunit install

Diff for: Readme.md

-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Translation Bundle
22

33
[![Latest Version](https://img.shields.io/github/release/php-translation/symfony-bundle.svg?style=flat-square)](https://github.com/php-translation/symfony-bundle/releases)
4-
[![Build Status](https://img.shields.io/travis/php-translation/symfony-bundle.svg?style=flat-square)](https://travis-ci.org/php-translation/symfony-bundle)
5-
[![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/php-translation/symfony-bundle.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/symfony-bundle)
6-
[![Quality Score](https://img.shields.io/scrutinizer/g/php-translation/symfony-bundle.svg?style=flat-square)](https://scrutinizer-ci.com/g/php-translation/symfony-bundle)
74
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/c289ebe2-41c4-429f-afba-de2f905b9bdb/mini.png)](https://insight.sensiolabs.com/projects/c289ebe2-41c4-429f-afba-de2f905b9bdb)
85
[![Total Downloads](https://img.shields.io/packagist/dt/php-translation/symfony-bundle.svg?style=flat-square)](https://packagist.org/packages/php-translation/symfony-bundle)
96

10-
117
**Symfony integration for PHP Translation**
128

139
## Install

Diff for: Tests/Unit/DependencyInjection/CompilerPass/ExternalTranslatorPassTest.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2424
$container->addCompilerPass(new ExternalTranslatorPass());
2525
}
2626

27-
/**
28-
* @test
29-
*/
30-
public function if_compiler_pass_collects_services_by_adding_method_calls_these_will_exist(): void
27+
public function testIfCompilerPassCollectsServicesByAddingMethodCallsTheseWillExist(): void
3128
{
3229
$collectingService = new Definition();
3330
$this->setDefinition('php_translation.translator_service.external_translator', $collectingService);

Diff for: Tests/Unit/DependencyInjection/CompilerPass/ExtractorPassTest.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2525
$container->addCompilerPass(new ExtractorPass());
2626
}
2727

28-
/**
29-
* @test
30-
*/
31-
public function if_compiler_pass_collects_services_by_adding_method_calls_these_will_exist(): void
28+
public function testIfCompilerPassCollectsServicesByAddingMethodCallsTheseWillExist(): void
3229
{
3330
$collectingService = new Definition();
3431
$this->setDefinition(Extractor::class, $collectingService);

Diff for: Tests/Unit/DependencyInjection/CompilerPass/StoragePassTest.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@ protected function registerCompilerPass(ContainerBuilder $container): void
2424
$container->addCompilerPass(new StoragePass());
2525
}
2626

27-
/**
28-
* @test
29-
*/
30-
public function if_compiler_pass_collects_services_by_adding_method_calls_these_will_exist(): void
27+
public function testIfCompilerPassCollectsServicesByAddingMethodCallsTheseWillExist(): void
3128
{
3229
$collectingService = new Definition();
3330
$this->setDefinition('php_translation.storage.foobar', $collectingService);

Diff for: Twig/Visitor/DefaultApplyingNodeVisitor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function doEnterNode(Node $node, Environment $env): Node
5959
}
6060

6161
if (!$transNode instanceof FilterExpression) {
62-
throw new \RuntimeException(\sprintf('The "desc" filter must be applied after a "trans", or "transchoice" filter.'));
62+
throw new \RuntimeException('The "desc" filter must be applied after a "trans", or "transchoice" filter.');
6363
}
6464

6565
$wrappingNode = $node->getNode('node');

0 commit comments

Comments
 (0)