[Tools] CI: prevent composer cache cross-versions contamination #2081
Workflow file for this run
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: PHP Code Quality | |
on: | |
push: | |
branches: | |
- 2.9.x | |
- 2.10.x | |
pull_request_target: | |
branches: | |
- 2.9.x | |
- 2.10.x | |
jobs: | |
qualit: | |
name: Code Quality | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
php-versions: ['7.4'] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Prepare directories | |
run: mkdir -p app/etc var | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, intl, bcmath, gd | |
ini-values: post_max_size=256M, max_execution_time=180 | |
- name: "Downgrade Composer" | |
run: composer self-update 2.1.14 | |
- name: Validate composer.json and composer.lock | |
run: composer validate | |
- name: Cache Composer packages | |
id: composer-cache | |
uses: actions/cache@v3 | |
with: | |
path: vendor | |
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-php-${{ matrix.php-versions }} | |
- name: Prepare credentials | |
env: | |
MAGENTO_USERNAME: ${{ secrets.MAGENTO_USERNAME }} | |
MAGENTO_PASSWORD: ${{ secrets.MAGENTO_PASSWORD }} | |
run: composer config -g http-basic.repo.magento.com "$MAGENTO_USERNAME" "$MAGENTO_PASSWORD" | |
- name: Install dependencies | |
if: steps.composer-cache.outputs.cache-hit != 'true' | |
run: composer install --prefer-dist --no-progress --no-suggest | |
- name: PHP Code Sniffer with Magento Extension Quality Program | |
run: | | |
vendor/bin/phpcs --config-set installed_paths vendor/magento/marketplace-eqp/ | |
vendor/bin/phpcs --standard=vendor/magento/marketplace-eqp/MEQP2 --severity=9 src/ | |
- name: PHP Code Sniffer with Smile Rules | |
run: vendor/bin/phpcs --standard=vendor/smile/magento2-smilelab-phpcs/phpcs-standards/SmileLab --extensions=php src/ | |
- name: PHPMD | |
run: vendor/bin/phpmd src text vendor/smile/magento2-smilelab-phpmd/phpmd-rulesets/rulset.xml | |
- name: PHPUnit | |
run: vendor/bin/phpunit -c Resources/tests/unit/phpunit.xml |