-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/2.10.x' into include-child-att…
…ributes-toggle
- Loading branch information
Showing
187 changed files
with
6,305 additions
and
454 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
name: PHPStan Code Quality | ||
|
||
on: | ||
push: | ||
branches: | ||
- 2.10.x | ||
|
||
pull_request_target: | ||
branches: | ||
- 2.10.x | ||
types: [labeled,synchronize] | ||
|
||
jobs: | ||
build: | ||
if: (github.event_name != 'pull_request') || contains(github.event.pull_request.labels.*.name, 'safe to test') | ||
runs-on: ubuntu-20.04 | ||
name: PHPStan Quality | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
php-versions: ['7.4'] | ||
magento-versions: ['2.4.2', '2.4.2-p1', '2.4.2-p2', '2.4.3', '2.4.3-p1'] | ||
magento-editions: ['enterprise'] | ||
experimental: [false] | ||
include: | ||
- php-versions: '8.1' | ||
magento-versions: '2.4.4' | ||
magento-editions: 'enterprise' | ||
experimental: false | ||
- php-versions: '8.1' | ||
magento-versions: '2.4.5' | ||
magento-editions: 'enterprise' | ||
experimental: true | ||
- php-versions: '8.1' | ||
magento-versions: '2.4.5-p1' | ||
magento-editions: 'enterprise' | ||
experimental: true | ||
|
||
continue-on-error: ${{ matrix.experimental }} | ||
|
||
env: | ||
magento-directory: /var/www/magento | ||
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }} | ||
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }} | ||
|
||
steps: | ||
- name: "[Init] Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
persist-credentials: false | ||
|
||
- name: "[Init] Setup PHP" | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: hash, iconv, mbstring, intl, bcmath, ctype, gd, pdo, mysql, curl, zip, dom, sockets, soap, openssl, simplexml, xsl | ||
ini-values: post_max_size=256M, max_execution_time=180 | ||
|
||
- name: "[Init] Setup Magento Directory" | ||
env: | ||
MAGENTO_ROOT: ${{ env.magento-directory }} | ||
version: ${{ matrix.php-versions }} | ||
run: | | ||
sudo usermod -a -G www-data $USER | ||
sudo mkdir -p $MAGENTO_ROOT | ||
sudo chown -R $USER:www-data $MAGENTO_ROOT | ||
- name: "[Init] Downgrade Composer" | ||
env: | ||
MAGENTO_VERSION: ${{ matrix.magento-versions }} | ||
run: | | ||
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | ||
if [ $(version $MAGENTO_VERSION) -lt $(version "2.4.2") ]; then | ||
composer self-update --1 | ||
else | ||
composer self-update 2.1.14 | ||
fi | ||
- name: "[Init] Optimize Composer" | ||
env: | ||
MAGENTO_VERSION: ${{ matrix.magento-versions }} | ||
run: | | ||
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | ||
if [ $(version $MAGENTO_VERSION) -lt $(version "2.4.2") ]; then | ||
composer global require hirak/prestissimo:0.3.10 | ||
fi | ||
- name: "[Init] Determine composer cache directory" | ||
id: composer-cache-directory | ||
run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" | ||
|
||
- name: "[Init] Cache Composer cache" | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache-directory.outputs.directory }} | ||
key: composer-${{ matrix.php-versions }}-${{ matrix.magento-editions }}-${{ matrix.magento-versions }} | ||
restore-keys: | | ||
composer-${{ matrix.php-versions }}-${{ matrix.magento-editions }}-${{ matrix.magento-versions }} | ||
composer-${{ matrix.php-versions }}-${{ matrix.magento-editions }}- | ||
composer-${{ matrix.php-versions }}- | ||
- name: "[Init] Cache Magento install" | ||
id: magento-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ env.magento-directory }} | ||
key: magento-${{ matrix.php-versions }}-${{ matrix.magento-editions }}-${{ matrix.magento-versions }} | ||
restore-keys: | | ||
magento-${{ matrix.php-versions }}-${{ matrix.magento-editions }}-${{ matrix.magento-versions }} | ||
- name: "[Init] Prepare credentials" | ||
if: ${{env.MAGENTO_USERNAME}} != 0 | ||
run: composer config -g http-basic.repo.magento.com "$MAGENTO_USERNAME" "$MAGENTO_PASSWORD" | ||
|
||
- name: "[Init] Unconditionally add phpstan/phpstan" | ||
working-directory: ${{ env.magento-directory }} | ||
run: composer require --no-update --dev smile/magento2-smilelab-phpstan ^1.0 | ||
|
||
- name: "[Init] Prepare Magento install if needed" | ||
if: steps.magento-cache.outputs.cache-hit == 'true' | ||
working-directory: ${{ env.magento-directory }} | ||
run: | | ||
rm -rf app/etc/env.php app/etc/config.php | ||
composer config discard-changes true | ||
composer remove smile/elasticsuite --no-update --no-interaction | ||
composer update --no-interaction --ignore-platform-reqs smile/elasticsuite | ||
composer config discard-changes false | ||
- name: "[Init] Install proper version of Magento through Composer" | ||
if: steps.magento-cache.outputs.cache-hit != 'true' | ||
env: | ||
MAGENTO_VERSION: ${{ matrix.magento-versions }} | ||
MAGENTO_EDITION: ${{ matrix.magento-editions }} | ||
MAGENTO_ROOT: ${{ env.magento-directory }} | ||
EXPERIMENTAL: ${{ matrix.experimental }} | ||
run: | | ||
STABILITY="--stability=stable" | ||
if [ $EXPERIMENTAL = true ]; then | ||
STABILITY="" | ||
fi | ||
sudo rm -rf $MAGENTO_ROOT | ||
sudo mkdir -p $MAGENTO_ROOT | ||
sudo chown -R $USER:www-data $MAGENTO_ROOT | ||
composer create-project --repository-url=https://repo.magento.com magento/project-$MAGENTO_EDITION-edition=$MAGENTO_VERSION $STABILITY $MAGENTO_ROOT --quiet | ||
- name: "[Init] Fix symfony/console and symfony string version" | ||
working-directory: ${{ env.magento-directory }} | ||
env: | ||
MAGENTO_VERSION: ${{ matrix.magento-versions }} | ||
run: | | ||
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | ||
if [ $(version $MAGENTO_VERSION) -lt $(version "2.4.4") ]; then | ||
composer require symfony/console:4.4.26 --ignore-platform-reqs | ||
composer require symfony/string:5.4.2 --ignore-platform-reqs | ||
fi | ||
- name: "[Init] Add current build of Elasticsuite" | ||
working-directory: ${{ env.magento-directory }} | ||
run: | | ||
composer require --dev "smile/elasticsuite:${GITHUB_BASE_REF:-${GITHUB_REF##*/}}-dev" --ignore-platform-reqs | ||
rm -rf vendor/smile/elasticsuite/** | ||
cp -Rf $GITHUB_WORKSPACE/* vendor/smile/elasticsuite/ | ||
- name: "[Init] Fix Magento directory permissions" | ||
env: | ||
MAGENTO_ROOT: ${{ env.magento-directory }} | ||
working-directory: ${{ env.magento-directory }} | ||
run: | | ||
sudo find . -type f -exec chmod 644 {} \; | ||
sudo find . -type d -exec chmod 755 {} \; | ||
sudo find var pub/static pub/media app/etc generated/ -type f -exec chmod g+w {} \; | ||
sudo find var pub/static pub/media app/etc generated/ -type d -exec chmod g+ws {} \; | ||
sudo chown -R $USER:www-data . | ||
sudo chmod u+x bin/magento | ||
- name: "[Init] Enabling modules" | ||
working-directory: ${{ env.magento-directory }} | ||
run: php bin/magento module:enable --all | ||
|
||
- name: "[Init] Compile" | ||
working-directory: ${{ env.magento-directory }} | ||
run: php bin/magento setup:di:compile | ||
|
||
- name: "[Test] PHPStan" | ||
working-directory: ${{ env.magento-directory }} | ||
run: | | ||
sudo chmod u+x vendor/bin/phpstan | ||
vendor/bin/phpstan analyze --level=0 vendor/smile/elasticsuite | ||
- name: "[End] Job failed, gathering logs" | ||
env: | ||
MAGENTO_ROOT: ${{ env.magento-directory }} | ||
if: ${{ failure() }} | ||
run: | | ||
tail -n 100 $MAGENTO_ROOT/var/log/*.log |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
parameters: | ||
level: 6 | ||
checkMissingIterableValueType: false | ||
paths: | ||
- src | ||
|
||
includes: | ||
- vendor/smile/magento2-smilelab-phpstan/extension.neon |
Oops, something went wrong.