Skip to content

Commit

Permalink
[CI] Moved to Github Actions (#62)
Browse files Browse the repository at this point in the history
* [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]>
  • Loading branch information
mnocon and konradoboza authored Jan 17, 2022
1 parent 2b57105 commit 5d54d23
Show file tree
Hide file tree
Showing 14 changed files with 154 additions and 143 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/browser-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Browser tests

on:
push:
branches:
- main
- '[0-9]+.[0-9]+'
pull_request: ~

jobs:
query-fieldtype:
name: "Page Builder browser tests"
uses: ibexa/gh-workflows/.github/workflows/browser-tests.yml@main
with:
project-edition: 'oss'
project-version: '^3.3.x-dev'
test-suite: '--profile=browser --suite=admin-ui --tags=@contentQuery'
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
73 changes: 73 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on:
push:
branches:
- main
- '[0-9]+.[0-9]+'
pull_request: ~

jobs:
cs-fix:
name: Run code style check
runs-on: "ubuntu-20.04"
strategy:
matrix:
php:
- '8.0'
steps:
- uses: actions/checkout@v2

- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
extensions: 'pdo_sqlite, gd'
tools: cs2pr

- uses: "ramsey/composer-install@v1"
with:
dependency-versions: "highest"

- name: Run code style check
run: composer run-script check-cs -- --format=checkstyle | cs2pr

tests:
name: Unit tests
runs-on: "ubuntu-20.04"
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
php:
- '7.3'
- '7.4'
- '8.0'
composer-options: [ "" ]
include:
- php: '8.1'
composer-options: "--ignore-platform-req php"

steps:
- uses: actions/checkout@v2

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

- uses: "ramsey/composer-install@v1"
with:
dependency-versions: "highest"
composer-options: "${{ matrix.composer-options }}"

- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run unit test suite
run: composer test
2 changes: 1 addition & 1 deletion .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

return EzSystems\EzPlatformCodeStyle\PhpCsFixer\EzPlatformInternalConfigFactory::build()->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in([__DIR__ . '/src', __DIR__ . '/spec'])
->files()->name('*.php')
);
20 changes: 0 additions & 20 deletions .php_cs.spec

This file was deleted.

52 changes: 0 additions & 52 deletions .travis.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .travis/prepare_ezplatform.sh

This file was deleted.

15 changes: 9 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,28 @@
}
},
"require-dev": {
"ezsystems/ezplatform-core": "^2.3@dev",
"ezsystems/doctrine-dbal-schema": "^1.0@dev",
"ezsystems/ez-support-tools": "^2.0@dev",
"ezsystems/ezplatform-design-engine": "^3.0@dev",
"ezsystems/ezplatform-http-cache": "^2.3@dev",
"ezsystems/ezplatform-richtext": "^2.0@dev",
"ezsystems/ezplatform-search": "^1.0@dev",
"ezsystems/ezplatform-user": "^2.0@dev",
"phpspec/phpspec": "^6.0",
"phpspec/phpspec": "^7.1",
"ezsystems/ezplatform-code-style": "^0.1.0",
"friendsofphp/php-cs-fixer": "^2.16.0"
"friendsofphp/php-cs-fixer": "^2.16.0",
"ibexa/ci-scripts": "^0.1@dev"
},
"scripts": {
"fix-cs": [
"php-cs-fixer --ansi fix -v --show-progress=estimating",
"php-cs-fixer --ansi fix --config=.php_cs.spec -v --show-progress=estimating"
]
"fix-cs": "php-cs-fixer --ansi fix -v --show-progress=estimating",
"check-cs": "@fix-cs --dry-run",
"test": "phpspec run --format=pretty"
},
"extra": {
"_ezplatform_branch_for_behat_tests": "master",
"branch-alias": {
"dev-master": "2.3.x-dev",
"dev-tmp_ci_branch": "2.3.x-dev",
"dev-2.1": "2.3.x-dev"
}
Expand Down
10 changes: 5 additions & 5 deletions spec/API/ExceptionSafeQueryFieldServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class ExceptionSafeQueryFieldServiceSpec extends ObjectBehavior
{
function let(QueryFieldServiceInterface $queryFieldService)
public function let(QueryFieldServiceInterface $queryFieldService)
{
$arguments = [
Argument::type(Content::class),
Expand All @@ -30,24 +30,24 @@ function let(QueryFieldServiceInterface $queryFieldService)
$this->beConstructedWith($queryFieldService);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType(ExceptionSafeQueryFieldService::class);
}

function it_should_return_empty_results_on_count_content_items()
public function it_should_return_empty_results_on_count_content_items()
{
$result = $this->countContentItems(new Content([]), 'any');
$result->shouldBe(0);
}

function it_should_return_empty_results_on_load_content_items()
public function it_should_return_empty_results_on_load_content_items()
{
$result = $this->loadContentItems(new Content([]), 'any');
$result->shouldBe([]);
}

function it_should_return_empty_results_on_load_content_items_slice()
public function it_should_return_empty_results_on_load_content_items_slice()
{
$result = $this->loadContentItemsSlice(new Content([]), 'any', 0, 5);
$result->shouldBe([]);
Expand Down
16 changes: 8 additions & 8 deletions spec/API/QueryFieldServiceSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class QueryFieldServiceSpec extends ObjectBehavior
private $searchHits;
private $totalCount = 0;

function let(
public function let(
SearchService $searchService,
ContentTypeService $contentTypeService,
LocationService $locationService,
Expand Down Expand Up @@ -65,22 +65,22 @@ function let(
$this->beConstructedWith($searchService, $contentTypeService, $locationService, $queryTypeRegistry);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType(QueryFieldService::class);
}

function it_loads_items_from_a_query_field_for_a_given_content_item()
public function it_loads_items_from_a_query_field_for_a_given_content_item()
{
$this->loadContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->searchHits);
}

function it_counts_items_from_a_query_field_for_a_given_content_item()
public function it_counts_items_from_a_query_field_for_a_given_content_item()
{
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe($this->totalCount);
}

function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService)
public function it_deducts_any_offset_when_counting_results(QueryType $queryType, SearchService $searchService)
{
$query = new ApiContentQuery();
$query->offset = 5;
Expand All @@ -93,7 +93,7 @@ function it_deducts_any_offset_when_counting_results(QueryType $queryType, Searc
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(2);
}

function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService)
public function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, SearchService $searchService)
{
$query = new ApiContentQuery();
$query->offset = 8;
Expand All @@ -106,15 +106,15 @@ function it_returns_zero_if_offset_is_bigger_than_count(QueryType $queryType, Se
$this->countContentItems($this->getContent(), self::FIELD_DEFINITION_IDENTIFIER)->shouldBe(0);
}

function it_returns_0_as_pagination_configuration_if_pagination_is_disabled()
public function it_returns_0_as_pagination_configuration_if_pagination_is_disabled()
{
$this->getPaginationConfiguration(
$this->getContent(self::CONTENT_TYPE_ID_WITHOUT_PAGINATION),
self::FIELD_DEFINITION_IDENTIFIER
)->shouldBe(0);
}

function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled()
public function it_returns_the_items_per_page_number_as_pagination_configuration_if_pagination_is_enabled()
{
$this->getPaginationConfiguration(
$this->getContent(),
Expand Down
16 changes: 8 additions & 8 deletions spec/GraphQL/ContentQueryFieldDefinitionMapperSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ContentQueryFieldDefinitionMapperSpec extends ObjectBehavior
const RETURNED_CONTENT_TYPE_IDENTIFIER = 'folder';
const GRAPHQL_TYPE = 'FolderContent';

function let(
public function let(
FieldDefinitionMapper $innerMapper,
NameHelper $nameHelper,
ContentTypeService $contentTypeService
Expand All @@ -39,13 +39,13 @@ function let(
$this->beConstructedWith($innerMapper, $nameHelper, $contentTypeService, self::FIELD_TYPE_IDENTIFIER);
}

function it_is_initializable()
public function it_is_initializable()
{
$this->shouldHaveType(ContentQueryFieldDefinitionMapper::class);
$this->shouldHaveType(FieldDefinitionMapper::class);
}

function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper)
public function it_returns_as_value_type_the_configured_ContentType_for_query_field_definitions(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->fieldDefinition();
$innerMapper->mapToFieldValueType($fieldDefinition)->shouldNotBeCalled();
Expand All @@ -54,7 +54,7 @@ function it_returns_as_value_type_the_configured_ContentType_for_query_field_def
->shouldBe('[' . self::GRAPHQL_TYPE . ']');
}

function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
public function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->getLambdaFieldDefinition();
$innerMapper->mapToFieldValueType($fieldDefinition)->willReturn('SomeType');
Expand All @@ -63,7 +63,7 @@ function it_delegates_value_type_to_the_inner_mapper_for_a_non_query_field_defin
->shouldBe('SomeType');
}

function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper)
public function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->fieldDefinition();
$innerMapper->mapToFieldDefinitionType($fieldDefinition)->shouldNotBeCalled();
Expand All @@ -72,7 +72,7 @@ function it_returns_the_correct_field_definition_GraphQL_type(FieldDefinitionMap
->shouldBe('ContentQueryFieldDefinition');
}

function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
public function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query_field_definition(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->getLambdaFieldDefinition();
$innerMapper->mapToFieldDefinitionType($fieldDefinition)->willReturn('FieldValue');
Expand All @@ -81,7 +81,7 @@ function it_delegates_field_definition_type_to_the_parent_mapper_for_a_non_query
->shouldBe('FieldValue');
}

function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper)
public function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->fieldDefinition();
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();
Expand All @@ -90,7 +90,7 @@ function it_maps_the_field_value_when_pagination_is_disabled(FieldDefinitionMapp
->shouldBe('@=resolver("QueryFieldValue", [field, content])');
}

function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper)
public function it_maps_the_field_value_when_pagination_is_enabled(FieldDefinitionMapper $innerMapper)
{
$fieldDefinition = $this->fieldDefinition(true);
$innerMapper->mapToFieldValueResolver($fieldDefinition)->shouldNotBeCalled();
Expand Down
Loading

0 comments on commit 5d54d23

Please sign in to comment.