-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Vendic/feature/fix-integration-tests
fix integration tests
- Loading branch information
Showing
5 changed files
with
245 additions
and
16 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,76 @@ | ||
{ | ||
"name": "magento/project-community-edition", | ||
"description": "eCommerce Platform for Growth (Community Edition)", | ||
"type": "project", | ||
"license": [ | ||
"OSL-3.0", | ||
"AFL-3.0" | ||
], | ||
"config": { | ||
"preferred-install": "dist", | ||
"sort-packages": true | ||
}, | ||
"require": { | ||
"magento/product-community-edition": "2.4.1" | ||
}, | ||
"require-dev": { | ||
"allure-framework/allure-phpunit": "~1.2.0", | ||
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", | ||
"friendsofphp/php-cs-fixer": "~2.16.0", | ||
"lusitanian/oauth": "~0.8.10", | ||
"magento/magento-coding-standard": "*", | ||
"magento/magento2-functional-testing-framework": "^3.0", | ||
"pdepend/pdepend": "~2.7.1", | ||
"phpcompatibility/php-compatibility": "^9.3", | ||
"phpmd/phpmd": "^2.8.0", | ||
"phpstan/phpstan": ">=0.12.3 <=0.12.23", | ||
"phpunit/phpunit": "^9", | ||
"reach-digital/magento2-test-framework": "^1.4", | ||
"sebastian/phpcpd": "~5.0.0", | ||
"squizlabs/php_codesniffer": "~3.5.4", | ||
"tddwizard/magento2-fixtures": "^1.0" | ||
}, | ||
"conflict": { | ||
"gene/bluefoot": "*" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Magento\\Framework\\": "lib/internal/Magento/Framework/", | ||
"Magento\\Setup\\": "setup/src/Magento/Setup/", | ||
"Magento\\": "app/code/Magento/", | ||
"Zend\\Mvc\\Controller\\": "setup/src/Zend/Mvc/Controller/" | ||
}, | ||
"psr-0": { | ||
"": [ | ||
"app/code/", | ||
"generated/code/" | ||
] | ||
}, | ||
"files": [ | ||
"app/etc/NonComposerComponentRegistration.php" | ||
], | ||
"exclude-from-classmap": [ | ||
"**/dev/**", | ||
"**/update/**", | ||
"**/Test/**" | ||
] | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Magento\\Sniffs\\": "dev/tests/static/framework/Magento/Sniffs/", | ||
"Magento\\Tools\\": "dev/tools/Magento/Tools/", | ||
"Magento\\Tools\\Sanity\\": "dev/build/publication/sanity/Magento/Tools/Sanity/", | ||
"Magento\\TestFramework\\Inspection\\": "dev/tests/static/framework/Magento/TestFramework/Inspection/", | ||
"Magento\\TestFramework\\Utility\\": "dev/tests/static/framework/Magento/TestFramework/Utility/" | ||
} | ||
}, | ||
"version": "2.3.3", | ||
"minimum-stability": "stable", | ||
"repositories": [ | ||
{"type": "composer", "url": "https://repo.packagist.com/vendic/"}, | ||
{"packagist.org": false} | ||
], | ||
"extra": { | ||
"magento-force": "override" | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
return [ | ||
'db-host' => '{{mysql-host}}', | ||
'db-user' => '{{mysql-user}}', | ||
'db-password' => '{{mysql-password}}', | ||
'db-name' => '{{mysql-db-name}}', | ||
'db-prefix' => '', | ||
'backend-frontname' => 'backend', | ||
'search-engine' => 'elasticsearch7', | ||
'elasticsearch-host' => '{{elasticsearch-host}}', | ||
'elasticsearch-port' => '{{elasticsearch-port}}', | ||
'admin-user' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, | ||
'admin-password' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD, | ||
'admin-email' => \Magento\TestFramework\Bootstrap::ADMIN_EMAIL, | ||
'admin-firstname' => \Magento\TestFramework\Bootstrap::ADMIN_FIRSTNAME, | ||
'admin-lastname' => \Magento\TestFramework\Bootstrap::ADMIN_LASTNAME | ||
]; |
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,148 @@ | ||
name: Tests | ||
env: | ||
COMPOSER_TOKEN: ${{ secrets.COMPOSER_TOKEN }} | ||
PHP_VERSION: ${{ secrets.PHP_VERSION }} | ||
MYSQL_HOST: ${{ secrets.MYSQL_HOST }} | ||
MYSQL_PASSWORD: ${{ secrets.MYSQL_PASSWORD }} | ||
MYSQL_USER: ${{ secrets.MYSQL_USER }} | ||
MYSQL_PORT: ${{ secrets.MYSQL_PORT }} | ||
ELASTIC_HOST: ${{ secrets.ELASTIC_HOST }} | ||
ELASTIC_PORT: 9200 | ||
PACKAGIST_URL: ${{ secrets.PACKAGIST_URL }} | ||
MAGENTO_VERSION: '2.4.2' | ||
MODULE_NAME: 'vendic/magento2-postcode-nl' | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
tags-ignore: | ||
- '*.*.*' | ||
|
||
jobs: | ||
phpcs: | ||
name: Code styling | ||
runs-on: self-hosted | ||
steps: | ||
- name: Clean | ||
run: | | ||
if [ -f "/home/runner/.ssh/id_rsa" ]; then rm /home/runner/.ssh/id_rsa; fi | ||
echo "Cleaning up previous run" | ||
rm -rf "${{ github.workspace }}" | ||
rm -rf $HOME/.ssh | ||
mkdir -p "${{ github.workspace }}" | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ env.PHP_VERSION }} | ||
tools: composer:v1, | ||
extensions: gd, bcmath, soap, pdo_mysql, ctype, curl, dom, hash, iconv, intl, mbstring, openssl, simplexml, xsl, sockets, zip | ||
env: | ||
runner: self-hosted | ||
|
||
- name: Create empty folders | ||
run: | | ||
mkdir -p app/etc | ||
touch app/etc/vendor_path.php | ||
- name: Setup composer repositories | ||
run: | | ||
composer config repositories.private-packagist composer ${{ env.PACKAGIST_URL }} | ||
composer config repositories.packagist.org false | ||
- name: Install composer dependencies | ||
run: | | ||
composer config --global --auth http-basic.repo.packagist.com token ${{ env.COMPOSER_TOKEN }} | ||
composer install --prefer-dist | ||
- name: Run phpcs | ||
run: | | ||
vendor/bin/phpcs --config-set installed_paths vendor/magento/magento-coding-standard/ | ||
vendor/bin/phpcs --standard=Magento2 ./ --ignore="*vendor/*" | ||
integration: | ||
name: Integration tests | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clean | ||
run: | | ||
if [ -f "/home/runner/.ssh/id_rsa" ]; then rm /home/runner/.ssh/id_rsa; fi | ||
echo "Cleaning up previous run" | ||
rm -rf "${{ github.workspace }}" | ||
rm -rf $HOME/.ssh | ||
mkdir -p "${{ github.workspace }}" | ||
- uses: actions/checkout@v2 | ||
- uses: FranzDiebold/github-env-vars-action@v2 | ||
|
||
- name: Set DB name | ||
run: | | ||
# DB name | ||
DB_NAME=$(< /dev/urandom tr -dc a-z | head -c9) | ||
echo "DB_NAME=$DB_NAME" >> $GITHUB_ENV | ||
- name: Setup PHP with PECL extension | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: none | ||
php-version: ${{ env.PHP_VERSION }} | ||
tools: composer:v1 | ||
extensions: gd, bcmath, soap, pdo_mysql, ctype, curl, dom, hash, iconv, intl, mbstring, openssl, simplexml, xsl, sockets, zip | ||
env: | ||
runner: self-hosted | ||
|
||
- name: Create folder for Magento 2 | ||
run: | | ||
mkdir magento2 | ||
chmod 775 magento2 | ||
- name: Setup composer authentication | ||
run: | | ||
composer config --global --auth http-basic.repo.packagist.com token ${{ env.COMPOSER_TOKEN }} | ||
- name: Copy Magento 2 composer.json | ||
run: | | ||
cp .github/workflows/_files/composer.json magento2/composer.json | ||
- name: Prepare test database | ||
run: | | ||
echo 'CREATE DATABASE IF NOT EXISTS ${{ env.DB_NAME }};' | mysql -h ${{ env.MYSQL_HOST }} -u${{ env.MYSQL_USER}} -p${{ env.MYSQL_PASSWORD }} --port=${{ env.MYSQL_PORT }} | ||
- name: Prepare integration test config | ||
run: | | ||
sed -i -e "s/{{mysql-db-name}}/${{ env.DB_NAME }}/g" .github/workflows/_files/install-config-mysql.php | ||
sed -i -e "s/{{mysql-host}}/${{ env.MYSQL_HOST }}:${{ env.MYSQL_PORT }}/g" .github/workflows/_files/install-config-mysql.php | ||
sed -i -e "s/{{mysql-password}}/${{ env.MYSQL_PASSWORD }}/g" .github/workflows/_files/install-config-mysql.php | ||
sed -i -e "s/{{mysql-user}}/${{ env.MYSQL_USER }}/g" .github/workflows/_files/install-config-mysql.php | ||
sed -i -e "s/{{elasticsearch-host}}/${{ env.ELASTIC_HOST }}/g" .github/workflows/_files/install-config-mysql.php | ||
sed -i -e "s/{{elasticsearch-port}}/${{ env.ELASTIC_PORT }}/g" .github/workflows/_files/install-config-mysql.php | ||
mkdir -p magento2/dev/tests/integration/etc | ||
cp .github/workflows/_files/install-config-mysql.php magento2/dev/tests/integration/etc/install-config-mysql.php | ||
cat magento2/dev/tests/integration/etc/install-config-mysql.php | ||
- name: Setup Magento 2 | ||
run: | | ||
cd magento2 | ||
COMPOSER_MEMORY_LIMIT=-3 composer require magento/product-community-edition ${{ env.MAGENTO_VERSION }} --no-update | ||
COMPOSER_MEMORY_LIMIT=-3 composer update | ||
COMPOSER_MEMORY_LIMIT=-3 composer config minimum-stability dev | ||
- name: Install module | ||
run: | | ||
cd magento2 | ||
COMPOSER_MEMORY_LIMIT=-3 composer require ${{ env.MODULE_NAME }}:dev-${{ env.CI_REF_NAME }} | ||
- name: Run integration tests | ||
run: | | ||
cd magento2/dev/tests/integration | ||
../../../vendor/bin/phpunit -c phpunit.xml.dist ../../../vendor/${{ env.MODULE_NAME }} | ||
- name: Clean DB | ||
if: ${{ always() }} | ||
run: | | ||
echo 'DROP DATABASE IF EXISTS ${{ env.DB_NAME }};' | mysql -h ${{ env.MYSQL_HOST }} -u${{ env.MYSQL_USER}} -p${{ env.MYSQL_PASSWORD }} --port=${{ env.MYSQL_PORT }} |
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