Skip to content

Merge pull request #3264 from astehlik/fix-rule-type #4751

Merge pull request #3264 from astehlik/fix-rule-type

Merge pull request #3264 from astehlik/fix-rule-type #4751

Workflow file for this run

name: Behat
on:
push:
branches: [ '2026.x' ]
paths:
- 'composer.json'
- 'features/**'
- 'behat.yml.dist'
- '*.php'
- 'src/**'
- '.github/workflows/behat.yml'
pull_request_target:
branches: [ '2026.x' ]
paths:
- 'composer.json'
- 'features/**'
- 'behat.yml.dist'
- '*.php'
- 'src/**'
- '.github/workflows/behat.yml'
release:
types: [ created ]
schedule:
- cron: "0 1 * * 1"
# A newer push to the same pull request or branch supersedes the run that is still going: the
# shards of the older run would only report on a commit nobody looks at any more. The event name
# is part of the group so that a release or the weekly schedule is never cancelled by a push that
# happens to share the ref.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
APP_ENV: "test"
CORESHOP_SKIP_DB_SETUP: "1"
PIMCORE_TEST_DB_DSN: "mysql://root:root@127.0.0.1:3306/coreshop_test"
DATABASE_URL: "mysql://root:root@127.0.0.1:3306/coreshop_test"
PIMCORE_OPENSEARCH_DSN: "opensearch://127.0.0.1:9200?ssl=false&ssl_verify=false"
PIMCORE_ADMIN_USER: "admin"
PIMCORE_ADMIN_PASSWORD: "admin"
PIMCORE_KERNEL_CLASS: 'Kernel'
PIMCORE_SECRET: "${{ secrets.PIMCORE_SECRET }}"
PIMCORE_INSTALL_ENCRYPTION_SECRET: "${{ secrets.PIMCORE_SECRET }}"
PIMCORE_INSTANCE_IDENTIFIER: "${{ secrets.PIMCORE_INSTANCE_IDENTIFIER }}"
PIMCORE_INSTALL_INSTANCE_IDENTIFIER: "${{ secrets.PIMCORE_INSTANCE_IDENTIFIER }}"
PIMCORE_INSTALL_PRODUCT_KEY: "${{ secrets.PIMCORE_PRODUCT_KEY }}"
PIMCORE_PRODUCT_KEY: "${{ secrets.PIMCORE_PRODUCT_KEY }}"
permissions:
contents: read
jobs:
behat:
# `release` and `schedule` always run the workflow file from the default branch, so this job
# also fires for releases of the other lines. Only tags of this line are checked here; the
# other lines have their own copy of this workflow.
if: ${{ github.event_name != 'release' || startsWith(github.event.release.tag_name, '2026.') }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.allow-failure }}
strategy:
fail-fast: false
matrix:
php: [ 8.4, 8.5 ]
pimcore: [ ^2026.2 ]
dependencies: [ highest ]
# The suites are spread over the shards by scenario count. More shards only help while no
# single suite is longer than an even share, and the cart suite alone holds a good quarter
# of all domain scenarios — it is the floor. Keep this list and the `--shards` argument of
# the Behat step in sync.
shard: [ 1, 2, 3, 4 ]
include:
- php: 8.4
allow-failure: false
- php: 8.5
allow-failure: true
services:
database:
image: "mysql:8"
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
# Installing the Pimcore class definitions issues hundreds of CREATE/ALTER TABLE
# statements, and every one of them waits on an fsync. The test database lives and dies
# with the job, so it has no business touching the disk at all — a RAM disk takes the
# durability cost out of the DDL and out of the scenarios that write through it.
options: >-
--health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
--tmpfs /var/lib/mysql:rw,noexec,nosuid,size=2g
opensearch:
image: "opensearchproject/opensearch:2.11.1"
env:
discovery.type: single-node
plugins.security.disabled: "true"
OPENSEARCH_JAVA_OPTS: "-Xms512m -Xmx512m"
action.auto_create_index: "false"
ports:
- 9200:9200
name: "${{ matrix.pimcore }}, PHP ${{ matrix.php }}, Deps ${{ matrix.dependencies }}, Shard ${{ matrix.shard }}/4"
steps:
- uses: actions/checkout@v7
with:
# On `schedule` the workflow runs from the default branch and `github.sha` is that
# branch's head, not this line's — check the line's branch out explicitly. Releases
# (the tag) and pushes keep `github.sha`, pull requests their head commit.
ref: ${{ github.event.pull_request.head.sha || (github.event_name == 'schedule' && '2026.x') || github.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
allow-unsafe-pr-checkout: true
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: display_errors=On, display_startup_errors=On, error_reporting=32767
extensions: intl, gd, simpleXML, dom, exif, fileinfo, iconv, mbstring, mysqli, pdo_mysql, zip, zlib
- name: Check PHP Version
run: php -v
- name: Setup DB
run: |
mysql --host 127.0.0.1 --port ${{ job.services.database.ports['3306'] }} -uroot -proot -e "CREATE DATABASE coreshop_test CHARSET=utf8mb4;"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: pimcore/pimcore
run: composer req pimcore/pimcore:${{ matrix.pimcore }} --no-interaction --no-scripts --no-update
- if: matrix.dependencies == 'highest'
name: Install dependencies highest
run: composer update --no-progress --prefer-dist --optimize-autoloader
- if: matrix.dependencies == 'lowest'
name: Install dependencies lowest
run: composer update --no-progress --prefer-dist --optimize-autoloader --prefer-lowest
- name: Cache clear
run: bin/console cache:clear
- name: Assets Install
run: bin/console assets:install --symlink
- name: Configure OpenSearch Client
run: |
mkdir -p config/local
cat > config/local/opensearch.yaml << 'EOF'
pimcore_open_search_client:
clients:
default:
hosts: ['http://127.0.0.1:9200']
ssl_verification: false
EOF
- name: Install Pimcore
run: PIMCORE_KERNEL_CLASS=Kernel vendor/bin/pimcore-install --install-profile 'CoreShop\Bundle\CoreBundle\InstallProfile\CoreShopInstallProfile' --skip-validation --no-interaction
- name: Rebuild Pimcore classes
run: |
bin/console pimcore:deployment:classes-rebuild --force --create-classes
bin/console generic-data-index:update:index -r
- name: Install CoreShop
run: |
bin/console coreshop:install
- name: Run Behat
run: |
suites=$(php -d display_errors=stderr .github/bin/behat-shard.php --shard=${{ matrix.shard }} --shards=4)
if [ -z "$suites" ]; then
echo "No suites assigned to this shard."
exit 0
fi
# Behat takes a single --suite, so a shard runs its suites one after the other. Each of
# them runs even when an earlier one failed: stopping at the first failure would hide
# the rest of the shard's scenarios behind another full round trip.
status=0
for suite in $suites; do
echo "::group::behat --suite=$suite"
vendor/bin/behat --strict --no-interaction -vvv -f progress --config behat.yml.dist -p default --suite "$suite" || status=1
echo "::endgroup::"
done
exit $status