Skip to content

[Release] 5.1.2

[Release] 5.1.2 #3024

name: Packages Bundles
on:
push:
branches: [ '5.0', '5.1' ]
paths:
- 'src/CoreShop/Bundle/**'
- '.github/workflows/packages_bundles.yml'
pull_request:
branches: [ '5.0', '5.1' ]
paths:
- 'src/CoreShop/Bundle/**'
- '.github/workflows/packages_bundles.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
# event name keeps a release or the weekly schedule from being cancelled by a push on the same ref.
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
env:
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:
list:
runs-on: ubuntu-latest
name: "Create a list of packages"
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: "List Packages"
id: create-list
# A job per package spends more time checking out the repository and setting up PHP than
# it spends on the package itself, and it puts one check per package on every pull
# request. The packages are handed out in chunks instead: the same work, a fraction of
# the setup, and a check list that can still be read.
run: |
chunks=$(find src/CoreShop/Bundle -mindepth 2 -maxdepth 2 -type f -name composer.json -exec dirname '{}' \; \
| sed -e 's/src\/CoreShop\///g' \
| sort \
| jq --raw-input . \
| jq --slurp --compact-output --argjson size "$CHUNK_SIZE" \
'[range(0; length; $size) as $i | {index: ($i / $size + 1 | floor), packages: (.[$i:$i + $size] | join(" "))}]')
echo "chunks=$chunks" >> "$GITHUB_OUTPUT"
echo "$chunks" | jq .
env:
# Chunks run in parallel, the packages within a chunk one after another. Larger chunks
# save setup time and shorten the check list; smaller ones use more runners at once.
CHUNK_SIZE: 8
outputs:
chunks: "${{ steps.create-list.outputs.chunks }}"
test-packages:
needs: list
runs-on: ubuntu-latest
name: "Chunk ${{ matrix.chunk.index }}, PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}, Deps ${{ matrix.dependencies }}"
strategy:
fail-fast: false
matrix:
php: [ 8.3, 8.4 ]
pimcore: [ ^12.3 ]
dependencies: [ highest, lowest ]
chunk: "${{ fromJson(needs.list.outputs.chunks) }}"
exclude:
- php: 8.4
dependencies: lowest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, gd, simpleXML, dom, exif, fileinfo, iconv, mbstring, mysqli, pdo_mysql, zip, zlib
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependencies }}-packages-${{ hashFiles('src/CoreShop/Bundle/*/composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.dependencies }}-packages-
${{ runner.os }}-php-${{ matrix.php }}-
- name: Validate, install and analyse
# Every package of the chunk is checked even when an earlier one failed, so one broken
# package does not hide the state of the rest behind another round trip.
run: |
status=0
for package in ${{ matrix.chunk.packages }}; do
echo "::group::$package"
(
set -e
cd "src/CoreShop/$package"
composer validate --ansi --strict
composer req pimcore/pimcore:${{ matrix.pimcore }} --no-interaction --no-scripts --no-update
if [ "${{ matrix.dependencies }}" = 'lowest' ]; then
composer update --no-progress --prefer-dist --optimize-autoloader --prefer-lowest
else
composer update --no-progress --prefer-dist --optimize-autoloader
fi
cp ../../../../phpstan-package.neon phpstan.neon
vendor/bin/phpstan analyse -c phpstan.neon . -l 3
) || status=1
# Each package installs its own copy of Pimcore; a whole chunk of them at once does
# not fit on the runner.
rm -rf "src/CoreShop/$package/vendor"
echo "::endgroup::"
done
exit $status
env:
COMPOSER_ROOT_VERSION: dev-main