Skip to content

Commit

Permalink
Add test setup for content bundle integration (#693)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Aug 8, 2024
1 parent 7c74374 commit b478e88
Show file tree
Hide file tree
Showing 52 changed files with 979 additions and 2,792 deletions.
15 changes: 15 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2

jobs:
build:
docker:
- image: circleci/php:7.3-node-browsers
steps:
- checkout
- run:
name: Install OS dependencies (mysql, gd)
command: |
sudo apt-get install -y libpng-dev
sudo docker-php-ext-install pdo_mysql gd
parallel: true
- run: echo "Circle CI is not longer used on 3.0 can be removed when support for 2.x is removed"
2 changes: 1 addition & 1 deletion .github/workflows/crowdin-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v1
- name: Copy translation file
run: cp Resources/translations/admin.en.json admin.en.json
run: cp translations/admin.en.json admin.en.json
- name: Download Crowdin CLI
run: curl "https://downloads.crowdin.com/cli/v3/crowdin-cli.zip" --output crowdin-cli.zip && unzip crowdin-cli.zip
- name: Upload translations to crowdin
Expand Down
76 changes: 5 additions & 71 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,106 +9,48 @@ on:

jobs:
test:
name: "PHP ${{ matrix.php-version }} (elasticsearch ${{ matrix.elasticsearch-version }}, ${{ matrix.phpcr-transport }}, ${{ matrix.dependency-versions }})"
name: 'PHP ${{ matrix.php-version }} (${{ matrix.dependency-versions }}, Coverage ${{ matrix.coverage }})'
runs-on: ubuntu-latest

env:
DATABASE_URL: mysql://root:[email protected]:3306/sulu_test?serverVersion=5.7
PHPCR_TRANSPORT: ${{ matrix.phpcr-transport }}
APP_ENV: test
DATABASE_URL: mysql://root:[email protected]:3306/su_content_test?serverVersion=8.0.29&charset=utf8mb4&collation=utf8mb4_unicode_ci
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

strategy:
fail-fast: false
matrix:
include:
- php-version: '8.0'
elasticsearch-version: '7.11.1'
elasticsearch-package-constraint: '~7.11.0'
phpcr-transport: jackrabbit
- php-version: '8.2'
dependency-versions: 'lowest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
ELASTICSEARCH_HOST: '127.0.0.1:9200'

- php-version: '8.1'
elasticsearch-version: '7.11.1'
elasticsearch-package-constraint: '~7.11.0'
phpcr-transport: doctrinedbal
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
ELASTICSEARCH_HOST: '127.0.0.1:9200'

- php-version: '8.2'
elasticsearch-version: '7.11.1'
elasticsearch-package-constraint: '~7.11.0'
phpcr-transport: jackrabbit
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak
ELASTICSEARCH_HOST: '127.0.0.1:9200'

- php-version: '8.3'
elasticsearch-version: '7.17.2'
elasticsearch-package-constraint: '~7.17.0'
phpcr-transport: doctrinedbal
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
phpstan: false
env:
SYMFONY_DEPRECATIONS_HELPER: weak
ELASTICSEARCH_HOST: '127.0.0.1:9200'

- php-version: '8.4'
composer-options: '--ignore-platform-reqs'
elasticsearch-version: '8.14.3'
elasticsearch-package-constraint: '~7.17.0'
phpcr-transport: doctrinedbal
dependency-versions: 'highest'
php-extensions: 'ctype, iconv, mysql, imagick'
tools: 'composer:v2'
phpstan: false
env:
SYMFONY_DEPRECATIONS_HELPER: weak
ELASTICSEARCH_HOST: '127.0.0.1:9200'

services:
mysql:
image: mysql:5.7
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5

jackrabbit:
image: sulu/jackrabbit:2.20-tomcat-filesystem
env:
DATABASE_HOST: mysql
DATABASE_PORT: 3306
DATABASE_NAME: sulu_test_jackrabbit
DATABASE_USER: root
DATABASE_PASS: root
LOG_LEVEL: WARN
ports:
- 8080:8080

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch-version }}
ports:
- 9200:9200
env:
discovery.type: 'single-node'
xpack.security.enabled: 'false'
options: --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=5

steps:
- name: Checkout project
uses: actions/checkout@v4
Expand All @@ -126,9 +68,6 @@ jobs:
# testing lowest versions.
run: composer remove "*php-cs-fixer*" "*phpstan*" "*rector*" --dev --no-update

- name: Require elasticsearch dependency
run: composer require --dev elasticsearch/elasticsearch:"${{ matrix.elasticsearch-package-constraint }}" --no-interaction --no-update

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
Expand All @@ -137,11 +76,9 @@ jobs:

- name: Bootstrap test environment
run: composer bootstrap-test-environment
env: ${{ matrix.env }}

- name: Execute test cases
run: time composer test
env: ${{ matrix.env }}

lint:
name: "PHP Lint"
Expand All @@ -162,9 +99,6 @@ jobs:
tools: 'composer:v2'
coverage: none

- name: Require elasticsearch dependency
run: composer require --dev elasticsearch/elasticsearch:"~7.11.0" --no-interaction --no-update

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
Expand Down
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,8 @@ php-cs-fixer
.DS_Store

# Frontend Caches
bower_components/
.tmp/
.sass-cache/
node_modules/
npm-debug.log

# tests
.env.*.local
/Tests/Application/config/parameters.yml
/Tests/Application/var
/Tests/Functional/Import/export.test.xliff
/tests/Application/var
9 changes: 7 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@
EOF;

$finder = PhpCsFixer\Finder::create()
->exclude(['Tests/Application/var/cache'])
->in(__DIR__);
->in([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->exclude([
'Application/var/',
]);

$config = new PhpCsFixer\Config();
$config->setRiskyAllowed(true)
Expand Down
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ Execute the following [composer](https://getcomposer.org/) commands to add the b
project:

```bash
composer require "elasticsearch/elasticsearch:7.9.*" # should match version of your elasticsearch installation
composer require sulu/article-bundle
```

Afterwards, visit the [bundle documentation](Resources/doc) to
Afterwards, visit the [bundle documentation](docs) to
find out **how to set up and configure the SuluArticleBundle** to your specific needs.


Expand All @@ -67,18 +66,6 @@ In contrast to Sulu pages, articles are **managed in a flat list** instead of a
the Sulu page tree, the article bundle is **optimized for managing a big number of articles**.


### Elasticsearch dependency

The SuluArticleBundle was originally developed to be used in the publishing industry. To satisfy the initial
requirements regarding performance and scalability, a **view layer stored in an Elasticsearch index** was utilized.
Because of this, there is **no way to use the bundle without Elasticsearch** at the moment. It is planned to
remove this hard dependency in the next major version.

If you cannot or do not want to make Elasticsearch a dependency of your project, you can **use Sulu pages for
certain use cases** instead of the SuluArticleBundle. However, be aware that the article list provides a better
performance and is more comfortable to use with a large number of entities.


## ❤️  Support and Contributions

The Sulu content management system is a **community-driven open source project** backed by various partner companies.
Expand Down
32 changes: 0 additions & 32 deletions SuluArticleBundle.php

This file was deleted.

2 changes: 0 additions & 2 deletions Tests/Application/.env

This file was deleted.

42 changes: 0 additions & 42 deletions Tests/Application/bin/console.php

This file was deleted.

19 changes: 0 additions & 19 deletions Tests/Application/config/templates/articles/article.xml

This file was deleted.

Loading

0 comments on commit b478e88

Please sign in to comment.