Skip to content

Apply php-cs-fixer changes #422

Apply php-cs-fixer changes

Apply php-cs-fixer changes #422

name: Test Pimcore Skeleton
on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "*_actions"
jobs:
test-pimcore-skeleton:
if: github.repository == 'pimcore/skeleton'
runs-on: ubuntu-latest
steps:
# Check out the repo in a sub-dir to see if it can serve as
# teplate for `composer create-project`
# See: https://github.com/actions/checkout#usage
- uses: actions/checkout@v2
with:
path: 'skeleton'
- name: Pull latest pimcore image
run: |
# Echo commands and terminate on first error
set -ex
# Pull latest build of pimcore's image
docker pull docker.io/pimcore/pimcore:php8.5-max-5.x
- name: Create project from skeleton in latest pimcore environment
run: |
# Echo commands and terminate on first error
set -ex
# Try creating a new project with composer using contents of this repo as the package.
# We execute composer within docker container to suttisfy platform requirements.
# The value of ´"url":` must match checkout path in the first step.
#
# Using --no-install so dependencies are installed later inside
# docker-compose where infrastructure services (db, etc.) are available.
#
# See: https://getcomposer.org/doc/03-cli.md#create-project
# See: https://getcomposer.org/doc/05-repositories.md#path
docker run \
--volume=${{ github.workspace }}/:/test/ \
--workdir=/test/ \
--user=$(id -u):$(id -g) \
docker.io/pimcore/pimcore:php8.5-max-5.x \
composer create-project \
pimcore/skeleton:@dev \
--repository='{"type": "path", "url": "./skeleton"}' \
--no-install \
sample-project
- name: Smoke-test compose file
run: |
# Echo commands and terminate on first error
set -ex
# Check (lint) the compose file
docker compose version
cd sample-project/
docker compose config -q
- name: Test pimcore installation
env:
PIMCORE_INSTANCE_IDENTIFIER: ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }}
PIMCORE_ENCRYPTION_SECRET: ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }}
PIMCORE_PRODUCT_KEY: ${{ secrets.PIMCORE_CI_PRODUCT_KEY }}
run: |
# Echo commands and terminate on first error
set -ex
cd sample-project/
# Set up docker-compose.yaml to use current user's uid:gid, just like README.md suggests.
sed -i "s|#user: '1000:1000'|user: '$(id -u):$(id -g)'|g" docker-compose.yaml
# Start containers
docker compose pull --quiet
docker compose up -d
# Install dependencies inside docker-compose where services are available.
docker compose exec -T -- php composer install
# Install dockerize to wait for services (needs root for /usr/local/bin).
docker compose exec --user=root -T -- php bash -c '\
curl -sfL https://github.com/powerman/dockerize/releases/download/v0.11.5/dockerize-`uname -s`-`uname -m` \
| install /dev/stdin /usr/local/bin/dockerize'
# Wait for infrastructure services to be ready.
docker compose exec -T -- php dockerize -wait tcp://db:3306 -timeout 5m
docker compose exec -T -- php dockerize -wait tcp://opensearch:9200 -timeout 5m
docker compose exec -T -- php dockerize -wait tcp://rabbitmq:5672 -timeout 5m
# Run pimcore installation.
# Product registration secrets come from GitHub secrets.
# Everything else is read from .env.
docker compose exec -T \
-e PIMCORE_ENCRYPTION_SECRET="${PIMCORE_ENCRYPTION_SECRET}" \
-e PIMCORE_INSTANCE_IDENTIFIER="${PIMCORE_INSTANCE_IDENTIFIER}" \
-e PIMCORE_PRODUCT_KEY="${PIMCORE_PRODUCT_KEY}" \
-- php vendor/bin/pimcore-install --install-profile=App\\Installer\\SkeletonProfile --no-interaction
- name: Run codeception tests
env:
PIMCORE_INSTANCE_IDENTIFIER: ${{ secrets.PIMCORE_CI_INSTANCE_IDENTIFIER }}
PIMCORE_ENCRYPTION_SECRET: ${{ secrets.PIMCORE_CI_ENCRYPTION_SECRET }}
PIMCORE_PRODUCT_KEY: ${{ secrets.PIMCORE_CI_PRODUCT_KEY }}
run: |
# Echo commands and terminate on first error
set -ex
cd sample-project/
# Set up and execute codeception tests, just like README.md suggests.
docker compose run --user=root --rm test-php chown -R $(id -u):$(id -g) var/ public/var/
docker compose run --rm -T \
-e DATABASE_URL=mysql://pimcore:pimcore@test-db:3306/pimcore \
-e PIMCORE_ENCRYPTION_SECRET="${PIMCORE_ENCRYPTION_SECRET}" \
-e PIMCORE_INSTANCE_IDENTIFIER="${PIMCORE_INSTANCE_IDENTIFIER}" \
-e PIMCORE_PRODUCT_KEY="${PIMCORE_PRODUCT_KEY}" \
test-php vendor/bin/pimcore-install --install-profile=App\\Installer\\SkeletonProfile --no-interaction --skip-validation=opensearch --skip-validation=messenger-amqp --skip-validation=mercure
# Product registration secrets must be passed as a matched set —
# the product key is validated against the encryption secret.
docker compose run --rm -T \
-e PIMCORE_ENCRYPTION_SECRET="${PIMCORE_ENCRYPTION_SECRET}" \
-e PIMCORE_INSTANCE_IDENTIFIER="${PIMCORE_INSTANCE_IDENTIFIER}" \
-e PIMCORE_PRODUCT_KEY="${PIMCORE_PRODUCT_KEY}" \
test-php vendor/bin/codecept run -vv