Packages Components #189
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packages Components | |
on: | |
push: | |
branches: [ '2.2', '3.0', 'master' ] | |
pull_request: | |
branches: [ '2.2', '3.0', 'master' ] | |
release: | |
types: [ created ] | |
schedule: | |
- cron: "0 1 * * 1" | |
jobs: | |
list: | |
runs-on: ubuntu-latest | |
name: "Create a list of packages" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "List Packages" | |
id: create-list | |
run: echo "packages=$(find src/CoreShop/Component -mindepth 2 -maxdepth 2 -type f -name composer.json -exec dirname '{}' \; | sed -e 's/src\/CoreShop\///g' | sort | jq --raw-input . | jq --slurp . | jq -c .)" >> $GITHUB_OUTPUT | |
outputs: | |
packages: "${{ steps.create-list.outputs.packages }}" | |
test-packages: | |
needs: list | |
runs-on: ubuntu-latest | |
name: "${{ matrix.package }}, PHP ${{ matrix.php }}, Pimcore ${{ matrix.pimcore }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ 8.0, 8.1 ] | |
pimcore: [ ^10.5 ] | |
dependencies: [ highest, lowest ] | |
package: "${{ fromJson(needs.list.outputs.packages) }}" | |
exclude: | |
- php: 8.1 | |
dependencies: lowest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-php-${{ matrix.php }}-package-${{ matrix.package }}-composer-${{ hashFiles(format('src/CoreShop/{0}/composer.json', matrix.package)) }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.pimcore }}-package-${{ matrix.package }}-composer- | |
${{ runner.os }}-php-${{ matrix.php }}-${{ matrix.pimcore }}-package- | |
- name: Validate composer.json | |
run: composer validate --ansi --strict | |
working-directory: "src/CoreShop/${{ matrix.package }}" | |
- if: matrix.dependencies == 'highest' | |
name: Install dependencies highest | |
run: | | |
composer req pimcore/pimcore:${{ matrix.pimcore }} --no-interaction --no-scripts --no-update | |
composer update --no-progress --prefer-dist --optimize-autoloader | |
env: | |
COMPOSER_ROOT_VERSION: dev-master | |
working-directory: "src/CoreShop/${{ matrix.package }}" | |
- if: matrix.dependencies == 'lowest' | |
name: Install dependencies lowest | |
run: | | |
composer req pimcore/pimcore:${{ matrix.pimcore }} --no-interaction --no-scripts --no-update | |
composer update --no-progress --prefer-dist --optimize-autoloader --prefer-lowest | |
env: | |
COMPOSER_ROOT_VERSION: dev-master | |
working-directory: "src/CoreShop/${{ matrix.package }}" | |
- name: STAN | |
run: | | |
cp ../../../../phpstan-package.neon phpstan.neon | |
vendor/bin/phpstan analyse -c phpstan.neon . -l 3 | |
working-directory: "src/CoreShop/${{ matrix.package }}" |