Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c13c60b

Browse files
authored
Merge pull request #95 from symfonycorp/ci-php8-release
Automate releasing and add PHP 8 in CI
2 parents afefff9 + a3b52b2 commit c13c60b

8 files changed

Lines changed: 83 additions & 76 deletions

File tree

.circleci/config.yml

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,89 @@
1-
version: 2
1+
version: 2.1
22

3-
references:
4-
restore_dependencies_cache: &restore_dependencies_cache
5-
restore_cache:
6-
key: v1-deps-{{ checksum "composer.json" }}
3+
orbs:
4+
aws-s3: circleci/[email protected] # use the AWS S3 orb in your config
75

8-
install_dependencies: &install_dependencies
9-
run: composer install
10-
11-
save_dependencies_cache: &save_dependencies_cache
12-
save_cache:
13-
paths: [./vendor]
14-
key: v1-deps-{{ checksum "composer.json" }}
15-
16-
restore_phpunit_cache: &restore_phpunit_cache
17-
restore_cache:
18-
key: v1-phpunit-{{ checksum "composer.json" }}
19-
20-
install_phpunit: &install_phpunit
21-
run: php vendor/bin/simple-phpunit install
22-
23-
save_phpunit_cache: &save_phpunit_cache
24-
save_cache:
25-
paths: [./bin/.phpunit]
26-
key: v1-phpunit-{{ checksum "composer.json" }}
6+
jobs:
7+
tests-php-cs:
8+
docker:
9+
- image: php:8.0-cli-alpine
10+
steps:
11+
- checkout
12+
- run: wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.19.0/php-cs-fixer.phar
13+
- run: php php-cs-fixer.phar fix --dry-run --diff
2714

28-
run_tests: &run_tests
29-
resource_class: small
15+
tests-phpunit:
16+
parameters:
17+
php-version:
18+
type: string
19+
docker:
20+
- image: circleci/php:<< parameters.php-version >>
3021
steps:
22+
- run: sudo composer self-update
23+
3124
- checkout
3225

3326
# Dependencies
34-
- *restore_dependencies_cache
35-
- *install_dependencies
36-
- *save_dependencies_cache
27+
- restore_cache:
28+
key: v1-deps-{{ checksum "composer.json" }}
29+
- run: composer install
30+
- save_cache:
31+
paths: [ ./vendor ]
32+
key: v1-deps-{{ checksum "composer.json" }}
3733

3834
# Install PHPUnit
39-
- *restore_phpunit_cache
40-
- *install_phpunit
41-
- *save_phpunit_cache
35+
- restore_cache:
36+
key: v1-phpunit-{{ checksum "composer.json" }}
37+
- run: php vendor/bin/simple-phpunit install
38+
- save_cache:
39+
paths: [ ./bin/.phpunit ]
40+
key: v1-phpunit-{{ checksum "composer.json" }}
4241

4342
# Run the tests
4443
- run: php vendor/bin/simple-phpunit -v --log-junit ./phpunit/junit.xml
4544
- store_test_results:
4645
path: ./phpunit
4746

48-
jobs:
49-
php-cs:
47+
release:
5048
docker:
51-
- image: php:7.2-cli-alpine
52-
resource_class: small
49+
- image: circleci/php:7.4
5350
steps:
54-
- checkout
55-
- run: wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.13.1/php-cs-fixer.phar
56-
- run: php php-cs-fixer.phar fix --dry-run --diff
57-
58-
tests-php-7-1:
59-
docker:
60-
- image: circleci/php:7.1
61-
<<: *run_tests
62-
63-
tests-php-7-2:
64-
docker:
65-
- image: circleci/php:7.2
66-
<<: *run_tests
51+
- run: sudo composer self-update
6752

68-
tests-php-7-3:
69-
docker:
70-
- image: circleci/php:7.3
71-
<<: *run_tests
53+
- checkout
7254

73-
tests-php-7-4:
74-
docker:
75-
- image: circleci/php:7.4
76-
<<: *run_tests
55+
# Dependencies
56+
- restore_cache:
57+
key: v1-deps-{{ checksum "composer.json" }}
58+
- run: composer install
59+
- save_cache:
60+
paths: [ ./vendor ]
61+
key: v1-deps-{{ checksum "composer.json" }}
62+
63+
# Build
64+
- run: wget https://github.com/box-project/box/releases/download/3.13.0/box.phar -O /tmp/box.phar
65+
- run: php /tmp/box.phar build
66+
67+
# Test
68+
- run: build/insight.phar list
69+
70+
# Release
71+
- aws-s3/copy:
72+
from: build/insight.phar
73+
to: 's3://get.insight.symfony.com/insight.phar'
74+
arguments: '--acl public-read'
7775

7876
workflows:
7977
version: 2
8078
test:
8179
jobs:
82-
- php-cs
83-
- tests-php-7-1
84-
- tests-php-7-2
85-
- tests-php-7-3
86-
- tests-php-7-4
80+
- tests-php-cs
81+
- tests-phpunit:
82+
matrix:
83+
parameters:
84+
php-version: ['7.1', '7.2', '7.3', '7.4', '8.0']
85+
- release:
86+
requires: [tests-phpunit]
87+
filters:
88+
branches:
89+
only: ['master']

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"version":1,"defects":{"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testConstructorWithoutOption":6,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #0":6,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #1":6,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #2":6},"times":{"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testConstructorWithoutOption":0.007,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetProjects":0.021,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetProjectsWithPage":0.004,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetProject":0.008,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testCreateProjectOk":0.008,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testCreateProjectNOk":0.001,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testupdateProjectOk":0.008,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testupdateProjectNOk":0.001,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetAnalyses":0.002,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetAnalysis":0.007,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testGetAnalysisStatus":0.002,"SensioLabs\\Insight\\Sdk\\Tests\\ApiTest::testAnalyze":0.008,"SensioLabs\\Insight\\Tests\\Sdk\\Model\\ViolationsTest::testCount":0,"SensioLabs\\Insight\\Tests\\Sdk\\Model\\ViolationsTest::testIterable":0,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #0":0,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #1":0,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrorsFailedIfDocumentIfInvalid with data set #2":0.001,"SensioLabs\\Insight\\Sdk\\Tests\\ParserTest::testParseErrors":0}}

Cli/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
class Application extends SymfonyApplication
2727
{
2828
const APPLICATION_NAME = 'SymfonyInsight CLI';
29-
const APPLICATION_VERSION = '1.7.1';
29+
const APPLICATION_VERSION = '1.7.2';
3030

3131
private $api;
3232
private $apiConfig;

Sdk/Tests/ApiTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ApiTest extends TestCase
2525
private $api;
2626
private $logger;
2727

28-
protected function setUp()
28+
protected function setUp(): void
2929
{
3030
$this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock();
3131
}
@@ -218,7 +218,7 @@ public function testAnalyze()
218218
$this->assertInstanceOf('SensioLabs\Insight\Sdk\Model\Analysis', $analysis);
219219
}
220220

221-
protected function tearDown()
221+
protected function tearDown(): void
222222
{
223223
$this->logger = null;
224224
$this->api = null;

Sdk/Tests/ParserTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ParserTest extends TestCase
2121
*/
2222
private $parser;
2323

24-
protected function setUp()
24+
protected function setUp(): void
2525
{
2626
$this->parser = new Parser();
2727
}
@@ -65,7 +65,7 @@ public function testParseErrors()
6565
$this->assertSame($expectedFields, $error->getEntityBodyParameters());
6666
}
6767

68-
protected function tearDown()
68+
protected function tearDown(): void
6969
{
7070
$this->parser = null;
7171
}

box.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
{
2-
"chmod": "0755",
3-
"main": "bin/insight",
2+
"check-requirements": false,
43
"output": "build/insight.phar",
5-
"stub": true,
6-
"directories": ["."],
7-
"git-commit": "git-commit"
4+
"git-commit": "git-commit",
5+
"finder": [
6+
{"in": "bin"},
7+
{"in": "Cli"},
8+
{"in": "Sdk", "exclude": ["Tests"]},
9+
{"in": "vendor", "notName": "/LICENSE|.*\\.md|.*\\.dist|Makefile|composer\\.json|composer\\.lock/"}
10+
]
811
}

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
},
1414
"require-dev": {
1515
"monolog/monolog": "^1.4",
16-
"symfony/phpunit-bridge": "^4.4",
17-
"symfony/var-dumper": "^4.4"
16+
"symfony/phpunit-bridge": "^4.4|^5.3",
17+
"symfony/var-dumper": "^4.4|^5.3"
1818
},
1919
"suggest": {
2020
"monolog/monolog": "Will add some log capability to this library"

phpunit.xml.dist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
convertWarningsToExceptions = "true"
1010
processIsolation = "false"
1111
stopOnFailure = "false"
12-
syntaxCheck = "false"
1312
bootstrap = "vendor/autoload.php" >
1413

1514
<php>
1615
<ini name="error_reporting" value="-1" />
17-
<server name="SYMFONY_PHPUNIT_VERSION" value="7.5" />
16+
<server name="SYMFONY_MAX_PHPUNIT_VERSION" value="8" />
17+
<server name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
1818
</php>
1919

2020
<testsuites>

0 commit comments

Comments
 (0)