Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions .github/ci/files/composer.json

This file was deleted.

12 changes: 0 additions & 12 deletions .github/ci/scripts/setup-pimcore-environment-functional-tests.sh

This file was deleted.

1 change: 0 additions & 1 deletion .github/ci/scripts/setup-pimcore-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -eu
mkdir -p var/config
mkdir -p bin

cp .github/ci/files/.env .
cp -r .github/ci/files/config/. config
cp -r .github/ci/files/templates/. templates
cp -r .github/ci/files/bin/console bin/console
Expand Down
160 changes: 63 additions & 97 deletions .github/workflows/elastic-search-codeception.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: "Codeception Tests with Elasticsearch"

on:
# Enable Later.
schedule:
- cron: '0 3 * * 1,3,5'
- cron: "0 3 * * 1,3,5"
workflow_dispatch:
pull_request:
branches:
Expand All @@ -14,110 +13,77 @@ on:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"

env:
PIMCORE_PROJECT_ROOT: ${{ github.workspace }}
APP_ENV: test
PIMCORE_TEST: 1
PIMCORE_TEST_DB_DSN: "mysql://root@127.0.0.1:33006/pimcore_test"
PIMCORE_ELASTIC_SEARCH_HOST: "localhost:5300"
CODECEPTION_BUNDLE_PATH: "bundles/pimcore/generic-data-index-bundle/"
PIMCORE_INSTANCE_IDENTIFIER: ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }}
PIMCORE_ENCRYPTION_SECRET: ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }}
PIMCORE_PRODUCT_KEY: ${{ secrets.PIMCORE_CI_PRODUCT_KEY }}

jobs:
codeception-tests:
name: "Codeception tests"
runs-on: "ubuntu-latest"
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
include:
- { php-version: "8.4", dependencies: "highest", pimcore_version: "12.x-dev as 12.99.9", experimental: true, search_engine: "elasticsearch"}

services:
mariadb:
image: "mariadb:10.11"
ports:
- 33006:3306
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
PRIVATE_REPO: ${{ github.event.repository.private }}

elastic:
image: elasticsearch:8.5.3
ports:
- 5300:9200
env:
discovery.type: "single-node"
ES_JAVA_OPTS: "-Xms1g -Xmx1g"
xpack.security.enabled: "true"
xpack.security.authc.anonymous.roles: "superuser,kibana_admin,kibana_system,kibana_user"
ELASTIC_USERNAME: "elastic"
ELASTIC_PASSWORD: "somethingsecret"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
php_versions: ${{ steps.parse-php-versions.outputs.php_versions }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
private_repo: ${{ env.PRIVATE_REPO }}
steps:
- name: "Checkout code"
uses: "actions/checkout@v4"
with:
path: "bundles/pimcore/generic-data-index-bundle"

- name: "Copy .github directory"
env:
REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}"
run: |
cp -R bundles/pimcore/generic-data-index-bundle/.github .github

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: xdebug
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
php-version: "${{ matrix.php-version }}"

- name: Verify MariaDB connection
run: |
cp .github/ci/files/.my.cnf ~/.my.cnf
while ! mysqladmin ping --silent; do
sleep 1
done
- name: Checkout code
uses: actions/checkout@v4

- name: "Setup Pimcore environment"
env:
REQUIRE_ADMIN_BUNDLE: "${{ matrix.require_admin_bundle }}"
run: |
mysql -e "CREATE DATABASE pimcore_test CHARSET=utf8mb4;"
cp -R bundles/pimcore/generic-data-index-bundle/tests tests
mkdir src
chmod 755 .github/ci/scripts/setup-pimcore-environment-functional-tests.sh
.github/ci/scripts/setup-pimcore-environment-functional-tests.sh "${{ matrix.search_engine }}"
- name: Checkout reusable workflow repo
uses: actions/checkout@v4
with:
repository: pimcore/workflows-collection-public
ref: main
path: reusable-workflows

- name: "Wait for Elasticsearch to be up"
- name: Parse PHP versions from composer.json
id: parse-php-versions
run: |
if [ "${{ matrix.search_engine }}" == "elasticsearch" ]; then
echo "Waiting for Elasticsearch to be ready..."
until curl -s -u elastic:somethingsecret http://localhost:5300/_cluster/health | grep -q '"status":"green"'; do
echo "Waiting... Elasticsearch is not yet available."
sleep 5
done
echo "Elasticsearch is up and running!"
if [ -f composer.json ]; then
php_versions=$(jq -r '.require.php' composer.json | grep -oP '\d+\.\d+' | tr '\n' ',' | sed 's/,$//')
if [ -z "$php_versions" ]; then
echo "php_versions=default" >> "$GITHUB_OUTPUT"
else
echo "php_versions=$php_versions" >> "$GITHUB_OUTPUT"
fi
else
echo "Using OpenSearch for testing, skipping Elasticsearch wait."
fi
exit 1
fi

- name: "Update Pimcore version"
env:
PIMCORE_VERSION: "${{ matrix.pimcore_version }}"
- name: Set up matrix JSON
id: set-matrix
run: |
if [ ! -z "$PIMCORE_VERSION" ]; then
composer require --no-update pimcore/pimcore:"${PIMCORE_VERSION}"
fi

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "${{ matrix.dependencies }}"
php_versions="${{ steps.parse-php-versions.outputs.php_versions }}"
MATRIX_JSON=$(cat reusable-workflows/codeception-tests-configuration/matrix-config.json)
FILTERED_MATRIX_JSON=$(echo "$MATRIX_JSON" | jq --arg php_versions "$php_versions" '{ matrix: [ .configs[] | select(.php_version == $php_versions) | .matrix[] ] }')
ENCODED_MATRIX_JSON=$(echo "$FILTERED_MATRIX_JSON" | jq -c .)
echo "matrix=$ENCODED_MATRIX_JSON" >> "$GITHUB_OUTPUT"

- name: "Run Codeception"
run: |
vendor/bin/codecept run -c . -vvv --xml --coverage-xml
codeception-tests:
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
uses: pimcore/workflows-collection-public/.github/workflows/reusable-codeception-tests-centralized.yaml@main
with:
APP_ENV: test
PIMCORE_TEST: "1"
PRIVATE_REPO: ${{ needs.setup-matrix.outputs.private_repo }}
PHP_VERSION: ${{ matrix.matrix.php-version }}
DATABASE: "mariadb:10.11"
DEPENDENCIES: ${{ matrix.matrix.dependencies }}
EXPERIMENTAL: ${{ matrix.matrix.experimental }}
PIMCORE_VERSION: ${{ matrix.matrix.pimcore_version }}
REQUIRE_ADMIN_BUNDLE: "false"
PIMCORE_ELASTIC_SEARCH_HOST: "39201"
PIMCORE_ELASTIC_SEARCH_VERSION: "8.5.3"
ENABLE_ELASTICSEARCH: true
COVERAGE: "none"
secrets:
SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER: ${{ secrets.SSH_PRIVATE_KEY_PIMCORE_DEPLOYMENTS_USER }}
COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN: ${{ secrets.COMPOSER_PIMCORE_REPO_PACKAGIST_TOKEN }}
PIMCORE_CI_INSTANCE_IDENTIFIER: ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }}
PIMCORE_CI_ENCRYPTION_SECRET: ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }}
PIMCORE_CI_PRODUCT_KEY: ${{ secrets.PIMCORE_CI_PRODUCT_KEY }}
Loading
Loading