Skip to content

Commit 5d54d23

Browse files
mnoconkonradoboza
andauthored
[CI] Moved to Github Actions (#62)
* [CI] Moved to Github Actions * [CS] Unified CS configs and fixed codestyle * adjusted composer dependencies and added CI jobs for newer PHP versions Co-authored-by: konradoboza <[email protected]>
1 parent 2b57105 commit 5d54d23

14 files changed

+154
-143
lines changed

.github/workflows/browser-tests.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Browser tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '[0-9]+.[0-9]+'
8+
pull_request: ~
9+
10+
jobs:
11+
query-fieldtype:
12+
name: "Page Builder browser tests"
13+
uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main
14+
with:
15+
project-edition: 'oss'
16+
project-version: '^3.3.x-dev'
17+
test-suite: '--profile=browser --suite=admin-ui --tags=@contentQuery'
18+
secrets:
19+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/ci.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- '[0-9]+.[0-9]+'
8+
pull_request: ~
9+
10+
jobs:
11+
cs-fix:
12+
name: Run code style check
13+
runs-on: "ubuntu-20.04"
14+
strategy:
15+
matrix:
16+
php:
17+
- '8.0'
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Setup PHP Action
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ matrix.php }}
25+
coverage: none
26+
extensions: 'pdo_sqlite, gd'
27+
tools: cs2pr
28+
29+
- uses: "ramsey/composer-install@v1"
30+
with:
31+
dependency-versions: "highest"
32+
33+
- name: Run code style check
34+
run: composer run-script check-cs -- --format=checkstyle | cs2pr
35+
36+
tests:
37+
name: Unit tests
38+
runs-on: "ubuntu-20.04"
39+
timeout-minutes: 15
40+
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
php:
45+
- '7.3'
46+
- '7.4'
47+
- '8.0'
48+
composer-options: [ "" ]
49+
include:
50+
- php: '8.1'
51+
composer-options: "--ignore-platform-req php"
52+
53+
steps:
54+
- uses: actions/checkout@v2
55+
56+
- name: Setup PHP Action
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: ${{ matrix.php }}
60+
coverage: none
61+
extensions: pdo_sqlite, gd
62+
tools: cs2pr
63+
64+
- uses: "ramsey/composer-install@v1"
65+
with:
66+
dependency-versions: "highest"
67+
composer-options: "${{ matrix.composer-options }}"
68+
69+
- name: Setup problem matchers for PHPUnit
70+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
71+
72+
- name: Run unit test suite
73+
run: composer test

.php_cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
return EzSystems\EzPlatformCodeStyle\PhpCsFixer\EzPlatformInternalConfigFactory::build()->setFinder(
44
PhpCsFixer\Finder::create()
5-
->in(__DIR__ . '/src')
5+
->in([__DIR__ . '/src', __DIR__ . '/spec'])
66
->files()->name('*.php')
77
);

.php_cs.spec

Lines changed: 0 additions & 20 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

.travis/prepare_ezplatform.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

composer.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,28 @@
3636
}
3737
},
3838
"require-dev": {
39+
"ezsystems/ezplatform-core": "^2.3@dev",
3940
"ezsystems/doctrine-dbal-schema": "^1.0@dev",
4041
"ezsystems/ez-support-tools": "^2.0@dev",
4142
"ezsystems/ezplatform-design-engine": "^3.0@dev",
43+
"ezsystems/ezplatform-http-cache": "^2.3@dev",
4244
"ezsystems/ezplatform-richtext": "^2.0@dev",
4345
"ezsystems/ezplatform-search": "^1.0@dev",
4446
"ezsystems/ezplatform-user": "^2.0@dev",
45-
"phpspec/phpspec": "^6.0",
47+
"phpspec/phpspec": "^7.1",
4648
"ezsystems/ezplatform-code-style": "^0.1.0",
47-
"friendsofphp/php-cs-fixer": "^2.16.0"
49+
"friendsofphp/php-cs-fixer": "^2.16.0",
50+
"ibexa/ci-scripts": "^0.1@dev"
4851
},
4952
"scripts": {
50-
"fix-cs": [
51-
"php-cs-fixer --ansi fix -v --show-progress=estimating",
52-
"php-cs-fixer --ansi fix --config=.php_cs.spec -v --show-progress=estimating"
53-
]
53+
"fix-cs": "php-cs-fixer --ansi fix -v --show-progress=estimating",
54+
"check-cs": "@fix-cs --dry-run",
55+
"test": "phpspec run --format=pretty"
5456
},
5557
"extra": {
5658
"_ezplatform_branch_for_behat_tests": "master",
5759
"branch-alias": {
60+
"dev-master": "2.3.x-dev",
5861
"dev-tmp_ci_branch": "2.3.x-dev",
5962
"dev-2.1": "2.3.x-dev"
6063
}

spec/API/ExceptionSafeQueryFieldServiceSpec.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class ExceptionSafeQueryFieldServiceSpec extends ObjectBehavior
1616
{
17-
function let(QueryFieldServiceInterface $queryFieldService)
17+
public function let(QueryFieldServiceInterface $queryFieldService)
1818
{
1919
$arguments = [
2020
Argument::type(Content::class),
@@ -30,24 +30,24 @@ function let(QueryFieldServiceInterface $queryFieldService)
3030
$this->beConstructedWith($queryFieldService);
3131
}
3232

33-
function it_is_initializable()
33+
public function it_is_initializable()
3434
{
3535
$this->shouldHaveType(ExceptionSafeQueryFieldService::class);
3636
}
3737

38-
function it_should_return_empty_results_on_count_content_items()
38+
public function it_should_return_empty_results_on_count_content_items()
3939
{
4040
$result = $this->countContentItems(new Content([]), 'any');
4141
$result->shouldBe(0);
4242
}
4343

44-
function it_should_return_empty_results_on_load_content_items()
44+
public function it_should_return_empty_results_on_load_content_items()
4545
{
4646
$result = $this->loadContentItems(new Content([]), 'any');
4747
$result->shouldBe([]);
4848
}
4949

50-
function it_should_return_empty_results_on_load_content_items_slice()
50+
public function it_should_return_empty_results_on_load_content_items_slice()
5151
{
5252
$result = $this->loadContentItemsSlice(new Content([]), 'any', 0, 5);
5353
$result->shouldBe([]);

spec/API/QueryFieldServiceSpec.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class QueryFieldServiceSpec extends ObjectBehavior
3232
private $searchHits;
3333
private $totalCount = 0;
3434

35-
function let(
35+
public function let(
3636
SearchService $searchService,
3737
ContentTypeService $contentTypeService,
3838
LocationService $locationService,
@@ -65,22 +65,22 @@ function let(
6565
$this->beConstructedWith($searchService, $contentTypeService, $locationService, $queryTypeRegistry);
6666
}
6767

68-
function it_is_initializable()
68+
public function it_is_initializable()
6969
{
7070
$this->shouldHaveType(QueryFieldService::class);
7171
}
7272

73-
function it_loads_items_from_a_query_field_for_a_given_content_item()
73+
public function it_loads_items_from_a_query_field_for_a_given_content_item()
7474
{
7575
$this->loadContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->searchHits);
7676
}
7777

78-
function it_counts_items_from_a_query_field_for_a_given_content_item()
78+
public function it_counts_items_from_a_query_field_for_a_given_content_item()
7979
{
8080
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->totalCount);
8181
}
8282

83-
function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService)
83+
public function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService)
8484
{
8585
$query = new ApiContentQuery();
8686
$query->offset = 5;
@@ -93,7 +93,7 @@ function it_deducts_any_offset_when_counting_results(QueryType $queryType, Searc
9393
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(2);
9494
}
9595

96-
function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService)
96+
public function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService)
9797
{
9898
$query = new ApiContentQuery();
9999
$query->offset = 8;
@@ -106,15 +106,15 @@ function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, Se
106106
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(0);
107107
}
108108

109-
function it_returns_0_as_pagination_configuration_if_pagination_is_disabled()
109+
public function it_returns_0_as_pagination_configuration_if_pagination_is_disabled()
110110
{
111111
$this->getPaginationConfiguration(
112112
$this->getContent(self::CONTENT_TYPE_ID_WITHOUT_PAGINATION),
113113
self::FIELD_DEFINITION_IDENTIFIER
114114
)->shouldBe(0);
115115
}
116116

117-
function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled()
117+
public function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled()
118118
{
119119
$this->getPaginationConfiguration(
120120
$this->getContent(),

spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ContentQueryFieldDefinitionMapperSpec extends ObjectBehavior
2121
const RETURNED_CONTENT_TYPE_IDENTIFIER = 'folder';
2222
const GRAPHQL_TYPE = 'FolderContent';
2323

24-
function let(
24+
public function let(
2525
FieldDefinitionMapper $innerMapper,
2626
NameHelper $nameHelper,
2727
ContentTypeService $contentTypeService
@@ -39,13 +39,13 @@ function let(
3939
$this->beConstructedWith($innerMapper, $nameHelper, $contentTypeService, self::FIELD_TYPE_IDENTIFIER);
4040
}
4141

42-
function it_is_initializable()
42+
public function it_is_initializable()
4343
{
4444
$this->shouldHaveType(ContentQueryFieldDefinitionMapper::class);
4545
$this->shouldHaveType(FieldDefinitionMapper::class);
4646
}
4747

48-
function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper)
48+
public function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper)
4949
{
5050
$fieldDefinition = $this->fieldDefinition();
5151
$innerMapper->mapToFieldValueType($fieldDefinition)->shouldNotBeCalled();
@@ -54,7 +54,7 @@ function it_returns_as_value_type_the_configured_ContentType_for_query_field_def
5454
->shouldBe('[' . self::GRAPHQL_TYPE . ']');
5555
}
5656

57-
function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
57+
public function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
5858
{
5959
$fieldDefinition = $this->getLambdaFieldDefinition();
6060
$innerMapper->mapToFieldValueType($fieldDefinition)->willReturn('SomeType');
@@ -63,7 +63,7 @@ function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_defin
6363
->shouldBe('SomeType');
6464
}
6565

66-
function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper)
66+
public function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper)
6767
{
6868
$fieldDefinition = $this->fieldDefinition();
6969
$innerMapper->mapToFieldDefinitionType($fieldDefinition)->shouldNotBeCalled();
@@ -72,7 +72,7 @@ function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMap
7272
->shouldBe('ContentQueryFieldDefinition');
7373
}
7474

75-
function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
75+
public function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
7676
{
7777
$fieldDefinition = $this->getLambdaFieldDefinition();
7878
$innerMapper->mapToFieldDefinitionType($fieldDefinition)->willReturn('FieldValue');
@@ -81,7 +81,7 @@ function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query
8181
->shouldBe('FieldValue');
8282
}
8383

84-
function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper)
84+
public function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper)
8585
{
8686
$fieldDefinition = $this->fieldDefinition();
8787
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();
@@ -90,7 +90,7 @@ function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapp
9090
->shouldBe('@=resolver("QueryFieldValue", [field, content])');
9191
}
9292

93-
function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper)
93+
public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper)
9494
{
9595
$fieldDefinition = $this->fieldDefinition(true);
9696
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();

0 commit comments

Comments
 (0)