Skip to content

docs: add new dev:di:preferences:list command to README.md #1592

docs: add new dev:di:preferences:list command to README.md

docs: add new dev:di:preferences:list command to README.md #1592

---
name: Magento Platform Tests
on:
push:
branches:
- "master"
- "develop"
- "bugfix/*"
- "feature/*"
- "release/*"
paths:
- "bin/**"
- "config.yaml"
- "composer.json"
- "composer.lock"
- "res/**"
- "scoper.inc.php"
- "src/**"
- "version.txt"
pull_request_target:
branches:
- "master"
- "develop"
paths:
- "bin/**"
- "config.yaml"
- "composer.json"
- "composer.lock"
- "res/**"
- "scoper.inc.php"
- "src/**"
- "version.txt"
workflow_dispatch:
jobs:
phpunit:
name: Unit Tests
runs-on: ${{ matrix.operating-system }}
continue-on-error: true
strategy:
matrix:
include:
#- magento-version: magento-ce-2.4-develop
# operating-system: ubuntu-latest
# php-version: '8.1'
# mysql-version: '8.0'
# elasticsearch-version: 7.16.0
# composer-version: v2
# use-git-repository: true
# git-repository: https://github.com/magento/magento2.git
# git-branch: 2.4-develop
- magento-version: mage-os-latest
operating-system: ubuntu-latest
php-version: '8.1'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
- magento-version: mage-os-magento-mirror-2.4.5-p1
operating-system: ubuntu-latest
php-version: '8.1'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
- magento-version: mage-os-magento-mirror-2.4.3-p1
operating-system: ubuntu-latest
php-version: '7.4'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
- magento-version: magento-ce-2.4.7
operating-system: ubuntu-latest
php-version: '8.3'
mysql-version: '8.0'
elasticsearch-version: 7.16.0
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.7
operating-system: ubuntu-latest
php-version: '8.2'
mysql-version: '8.0'
elasticsearch-version: 7.16.0
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.6-p5
operating-system: ubuntu-latest
php-version: '8.2'
mysql-version: '8.0'
elasticsearch-version: 7.16.0
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.6-p5
operating-system: ubuntu-latest
php-version: '8.1'
mysql-version: '8.0'
elasticsearch-version: 7.16.0
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.5-p7
operating-system: ubuntu-latest
php-version: '8.1'
mysql-version: '8.0'
elasticsearch-version: 7.16.0
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
#- magento-version: magento-ce-2.4.4-p8
# operating-system: ubuntu-latest
# php-version: '8.1'
# mysql-version: '8.0'
# elasticsearch-version: 7.16.0
# composer-version: '2.2.17'
# use-git-repository: false
# git-repository: ""
# git-branch: ""
- magento-version: magento-ce-2.4.3-p2
operating-system: ubuntu-latest
php-version: '7.4'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.2-p1
operating-system: ubuntu-latest
php-version: '7.4'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
- magento-version: magento-ce-2.4.2
operating-system: ubuntu-latest
php-version: '7.4'
mysql-version: '8.0'
elasticsearch-version: '7.9.0'
composer-version: '2.2.17'
use-git-repository: false
git-repository: ""
git-branch: ""
services:
elaticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:${{ matrix.elasticsearch-version }}
# we bind the port to the host because the n98-magerun2 install command does not support to pass
# ES variables. So we cannot pass the random port via GitHub Action template variable.
ports:
- 9200:9200
- 9300:9300
options: -e="discovery.type=single-node" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
mysql:
image: mysql:${{ matrix.mysql-version }}
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: magento
ports:
- 3306
options: --tmpfs /tmp:rw --tmpfs /var/lib/mysql:rw --health-cmd="mysqladmin ping"
env:
MAGENTO_MARKETPLACE_USERNAME: ${{ secrets.MAGENTO_MARKETPLACE_USERNAME }}
MAGENTO_MARKETPLACE_PASSWORD: ${{ secrets.MAGENTO_MARKETPLACE_PASSWORD }}
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Dump GitHub context
run: echo "Register Github context"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
# https://github.com/marketplace/actions/setup-php-action#matrix-setup
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
tools: composer:${{ matrix.composer-version }}, cs2pr
php-version: ${{ matrix.php-version }}
extensions: mcrypt, mbstring, intl
coverage: none
- name: Checkout PR
uses: actions/[email protected]
if: github.event_name == 'pull_request_target'
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout HEAD
uses: actions/[email protected]
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
- name: Linux Setup
run: bash .github/workflows/linux-setup.sh
- name: Install Composer Presissimo Plugin
run: composer global require hirak/prestissimo
if: matrix.composer-version == 'v1'
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache Dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ runner.os }}-php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
restore-keys: "${{ runner.os }}-php-${{ matrix.php-version }}-composer-"
- name: Install dependencies
# If we have a very broad restore-keys in the previous caching action,
# we might pull outdated dependencies from a parent branch for new branches.
# Over time, just running composer all the time to give it a chance
# to fix the outdated dependencies should be faster than having to pull
# everything from scratch for every new branch.
run: composer install --no-interaction --prefer-dist --no-progress --no-suggest
- name: Setup Magento Open Source Repository Credentials
run: |
composer global config http-basic.repo.magento.com "${MAGENTO_MARKETPLACE_USERNAME}" "${MAGENTO_MARKETPLACE_PASSWORD}";
# only run for Magento Open Source versions
# -> this is also a test if mage-os can be installed without credentials
if: startsWith(matrix.magento-version, 'magento-ce')
- name: Install Magento via git
run: |
git clone --branch "${{ matrix.git-branch }}" --single-branch ${{ matrix.git-repository }} "$GITHUB_WORKSPACE/magento";
cd "$GITHUB_WORKSPACE/magento";
composer --version;
composer install --no-interaction;
bin/magento setup:install \
--db-host="127.0.0.1:${{ job.services.mysql.ports['3306'] }}" \
--db-user=root \
--db-password=root \
--db-name=magento \
--cleanup-database \
--session-save=db \
--backend-frontname=admin \
--timezone="Europe/Berlin" \
--currency="EUR" \
--base-url="http://github.magerun.test/" \
--use-rewrites=1 \
--use-secure=1 \
--use-secure-admin=1 \
--admin-user=admin \
--admin-password=Password123 \
--admin-firstname=Armin \
--admin-lastname=Admin \
--admin-email="[email protected]" \
--search-engine="elasticsearch7" \
--elasticsearch-host="127.0.0.1" \
--elasticsearch-port=9200;
if: matrix.use-git-repository == true
- name: Install ${{ matrix.magento-version }} via n98-magerun2
run: |
composer --version;
bin/n98-magerun2 --ansi install \
--magentoVersionByName="${{ matrix.magento-version }}" --installationFolder="$GITHUB_WORKSPACE/magento" \
--dbHost=127.0.0.1 --dbPort=${{ job.services.mysql.ports['3306'] }} --dbUser=root --dbPass=root --dbName="magento" \
--useDefaultConfigParams=yes \
--installSampleData=no \
--baseUrl="http://github.magerun.test/";
if: matrix.use-git-repository == false
# @link https://github.com/magento/magento2/issues/38728
- name: Temporary downgrade credis to 1.5 for Magento 2.4.6/2.4.7
run: composer require colinmollenhour/php-redis-session-abstract:1.5.5
working-directory: ./magento
if: matrix.magento-version == 'magento-ce-2.4.6-p5' || matrix.magento-version == 'magento-ce-2.4.7' || matrix.magento-version == 'mage-os-latest'
- name: Configure matchers
uses: mheap/phpunit-matcher-action@main
- name: Run PHPUnit (Developer Mode)
run: vendor/bin/phpunit --debug --process-isolation
- name: Activate Magento Production Mode
working-directory: ./magento
run: |
rm -Rf generated/code;
bin/magento deploy:mode:set production;
- name: Run PHPUnit (Production Mode)
run: vendor/bin/phpunit --debug --process-isolation
# phpstan is temporarily disabled until we can find a solution to run against several Magento versions
# or run only against the latest version?
## we run phpstan after di:compile in production mode to prevent class not found errors in Magerun sources
#- name: Run PHPStan
# working-directory: ./magento
# run:
# ../vendor/bin/phpstan analyse --level 1 --autoload-file="../src/bootstrap.php" ../src
# if: matrix.magento-version == 'magento-ce-2.4.5-p2'
- name: Setup PHP for phar build
uses: shivammathur/setup-php@v2
with:
tools: composer:2
php-version: "7.4"
- name: Build phar file
run: |
composer self-update --2;
composer --version;
composer global remove hirak/prestissimo;
bash ./build.sh;
composer self-update --rollback &> /dev/null || true;
- name: Setup PHP for project tests
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- name: Phar functional tests (Magerun)
run: bats tests/bats/functional_magerun_commands.bats
env:
N98_MAGERUN2_TEST_MAGENTO_ROOT: "${{ github.workspace }}/magento"
N98_MAGERUN2_BIN: "${{ github.workspace }}/n98-magerun2.phar"
- name: Phar functional tests (Magento Core)
run: bats tests/bats/functional_core_commands.bats
env:
N98_MAGERUN2_TEST_MAGENTO_ROOT: "${{ github.workspace }}/magento"
N98_MAGERUN2_BIN: "${{ github.workspace }}/n98-magerun2.phar"