Skip to content

Commit 2c3a2af

Browse files
authored
Merge pull request #12 from integer-net/ci-tools
Update CI tools configuration
2 parents a834dc8 + e63e097 commit 2c3a2af

9 files changed

+110
-27
lines changed

.scrutinizer.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
filter:
2+
excluded_paths:
3+
- 'tests/*'
4+
5+
build:
6+
environment:
7+
php: 7.3
8+
tests:
9+
override:
10+
- true
11+
nodes:
12+
analysis:
13+
dependencies:
14+
after:
15+
- vendor/bin/phpcs --config-set installed_paths ../../magento/magento-coding-standard/
16+
tests:
17+
override:
18+
- php-scrutinizer-run
19+
- phpcs-run
20+
21+
tools:
22+
external_code_coverage:
23+
runs: 1 # Scrutinizer will wait for one code coverage submission (integration test suite)
24+
timeout: 2400 # Timeout in seconds.

.travis.yml

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,38 @@
11
os: linux
2-
dist: trusty
2+
dist: xenial
33
group: edge
44
services:
5-
- elasticsearch
5+
- mysql
66
addons:
77
apt:
88
packages:
9-
- mysql-server-5.6
10-
- mysql-client-core-5.6
11-
- mysql-client-5.6
129
- postfix
1310
hosts:
1411
- magento2.travis
1512
language: php
1613
jobs:
1714
include:
18-
- php: 7.3
15+
- php: 7.2
1916
env:
2017
- MAGENTO_VERSION=2.3
2118
- TEST_SUITE=integration
2219
- php: 7.3
20+
env:
21+
- MAGENTO_VERSION=2.3
22+
- TEST_SUITE=integration
23+
- php: 7.4
24+
env:
25+
- MAGENTO_VERSION=2.4
26+
- TEST_SUITE=integration
27+
- COVERAGE=true
28+
- php: 7.4
2329
env:
2430
- MAGENTO_VERSION=2.4-develop
2531
- TEST_SUITE=integration
26-
- php: 7.2
32+
allow_failures:
33+
- php: 7.4
2734
env:
28-
- MAGENTO_VERSION=2.3
35+
- MAGENTO_VERSION=2.4-develop
2936
- TEST_SUITE=integration
3037
env:
3138
global:
@@ -35,12 +42,21 @@ cache:
3542
apt: true
3643
directories:
3744
- $HOME/.composer/cache
45+
before_install:
46+
- |
47+
[[ $TEST_SUITE == "unit" ]] || (
48+
curl -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-amd64.deb
49+
sudo dpkg -i --force-confnew elasticsearch-7.6.2-amd64.deb
50+
sudo chown -R elasticsearch:elasticsearch /etc/default/elasticsearch
51+
sudo service elasticsearch restart
52+
)
3853
before_script:
3954
- |
4055
sleep 10
56+
[[ $COVERAGE == "true" ]] || phpenv config-rm xdebug.ini
4157
./.travis/before_script.sh
42-
script: phpunit -c magento2/dev/tests/$TEST_SUITE --coverage-text --coverage-clover=/tmp/coverage.clover
58+
script: phpunit -c magento2/dev/tests/$TEST_SUITE `[[ $COVERAGE == "true" ]] && echo "--coverage-text --coverage-clover=/tmp/coverage.clover"`
4359
after_script:
4460
- |
45-
wget https://scrutinizer-ci.com/ocular.phar
46-
php ocular.phar code-coverage:upload --format=php-clover /tmp/coverage.clover
61+
[[ $COVERAGE == "true" ]] && wget https://scrutinizer-ci.com/ocular.phar
62+
[[ $COVERAGE == "true" ]] && php ocular.phar code-coverage:upload --format=php-clover /tmp/coverage.clover

.travis/before_script.sh

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44
trap '>&2 echo Error: Command \`$BASH_COMMAND\` on line $LINENO failed with exit code $?' ERR
55

66
# mock mail
@@ -23,15 +23,25 @@ cd magento2
2323

2424
# add composer package under test, composer require will trigger update/install
2525
composer config minimum-stability dev
26-
composer config repositories.travis_to_test git https://github.com/$TRAVIS_REPO_SLUG.git
27-
26+
composer config repositories.travis_to_test git https://github.com/${TRAVIS_REPO_SLUG}.git
2827
if [ ! -z $TRAVIS_TAG ]
2928
then
3029
composer require ${COMPOSER_PACKAGE_NAME}:${TRAVIS_TAG}
30+
elif [ ! -z $TRAVIS_PULL_REQUEST_BRANCH ]
31+
then
32+
# For pull requests, use the remote repository
33+
composer config repositories.travis_to_test git https://github.com/${TRAVIS_PULL_REQUEST_SLUG}.git
34+
composer require ${COMPOSER_PACKAGE_NAME}:dev-${TRAVIS_PULL_REQUEST_BRANCH}\#${TRAVIS_PULL_REQUEST_SHA}
3135
else
3236
composer require ${COMPOSER_PACKAGE_NAME}:dev-${TRAVIS_BRANCH}\#${TRAVIS_COMMIT}
3337
fi
3438

39+
# Add tests/src to autoload-dev on project level
40+
php -r '$composer_json = json_decode(file_get_contents("composer.json"), true);
41+
$composer_json["autoload-dev"]["psr-4"]["IntegerNet\\GlobalCustomLayout\\"] = "vendor/integer-net/magento2-global-custom-layout/tests/src";
42+
file_put_contents("composer.json", json_encode($composer_json));'
43+
composer dumpautoload
44+
3545
# prepare for test suite
3646
case $TEST_SUITE in
3747
integration)
@@ -44,11 +54,14 @@ case $TEST_SUITE in
4454
SET @@global.sql_mode = NO_ENGINE_SUBSTITUTION;
4555
CREATE DATABASE magento_integration_tests;
4656
'
47-
cp etc/install-config-mysql.travis.php.dist etc/install-config-mysql.php
57+
cp etc/install-config-mysql.php.dist etc/install-config-mysql.php
58+
# Remove AMQP configuration
4859
sed -i '/amqp/d' etc/install-config-mysql.php
60+
# Remove default root password
61+
sed -i 's/123123q//' etc/install-config-mysql.php
4962

5063
cd ../../..
51-
;;
64+
;;
5265
unit)
5366
cp vendor/$COMPOSER_PACKAGE_NAME/tests/Unit/phpunit.xml.dist dev/tests/unit/phpunit.xml
5467
;;

CHANGELOG.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7-
## 1.0.0 - 2020-04-27
8-
### Added
9-
- Plugins for category, product and page layouts that allow custom layout files to be loaded with a global identifier
10-
(`0`). E.g. `catalog_category_view_selectable_0_.xml` for Categories.
11-
12-
## 1.1.0 - 2020-05-02
7+
## 1.1.2 - 2020-05-11
138
### Added
14-
- Adds frontend test coverage for global custom layout updates
15-
- Fixes [#7](https://github.com/integer-net/magento2-global-custom-layout/issues/7) where layout handles were not merged in Product and Page Plugins' `afterFetchAvailableFiles()` method.
9+
- Updates travis, magento 2.4-dev now requires elasticsearch
10+
- Adds return type declaration (`void`) to `setUp()` functions, now needed for magento 2.4
1611

1712
## 1.1.1 - 2020-05-08
1813
### Added
1914
- Adds module registration test (registration.php coverage)
2015
- Adds travis config for tags/releases
2116

22-
## 1.1.2 - 2020-05-11
17+
## 1.1.0 - 2020-05-02
2318
### Added
24-
- Updates travis, magento 2.4-dev now requires elasticsearch
25-
- Adds return type declaration (`void`) to `setUp()` functions, now needed for magento 2.4
19+
- Adds frontend test coverage for global custom layout updates
20+
- Fixes [#7](https://github.com/integer-net/magento2-global-custom-layout/issues/7) where layout handles were not merged in Product and Page Plugins' `afterFetchAvailableFiles()` method.
21+
22+
## 1.0.0 - 2020-04-27
23+
### Added
24+
- Plugins for category, product and page layouts that allow custom layout files to be loaded with a global identifier
25+
(`0`). E.g. `catalog_category_view_selectable_0_.xml` for Categories.

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Build Status][ico-travis]][link-travis]
66
[![Coverage Status][ico-scrutinizer]][link-scrutinizer]
77
[![Quality Score][ico-code-quality]][link-code-quality]
8+
![Supported Magento Versions][ico-compatibility]
89

910
Allows you to add global layout update files to be selected from admin, by using `0` instead of a `category_id` / `sku` / `url_path`.
1011

@@ -92,6 +93,7 @@ The MIT License (MIT). Please see [License File](LICENSE.txt) for more informati
9293
[ico-travis]: https://img.shields.io/travis/integer-net/magento2-global-custom-layout/master.svg?style=flat-square
9394
[ico-scrutinizer]: https://scrutinizer-ci.com/g/integer-net/magento2-global-custom-layout/badges/coverage.png?b=master
9495
[ico-code-quality]: https://img.shields.io/scrutinizer/g/integer-net/magento2-global-custom-layout.svg?style=flat-square
96+
[ico-compatibility]: https://img.shields.io/badge/magento-%202.3%20|%202.4-brightgreen.svg?logo=magento&longCache=true&style=flat-square
9597
9698
[link-packagist]: https://packagist.org/packages/integer-net/magento2-global-custom-layout
9799
[link-travis]: https://travis-ci.org/integer-net/magento2-global-custom-layout

composer.json

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
}
3535
],
3636
"require-dev": {
37+
"phpro/grumphp": "^v0.21.0",
38+
"phpstan/phpstan": "^0.12.0",
3739
"magento/magento-coding-standard": "@dev"
3840
}
3941
}

grumphp.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
grumphp:
2+
tasks:
3+
composer: []
4+
phpcs: ~
5+
phpstan:
6+
configuration: phpstan.neon
7+
phpparser:
8+
visitors:
9+
no_exit_statements: ~
10+
forbidden_function_calls:
11+
blacklist:
12+
- 'var_dump'

phpcs.xml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<ruleset>
3+
<exclude-pattern>tests/</exclude-pattern>
4+
<rule ref="Magento2"/>
5+
</ruleset>

phpstan.neon

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
parameters:
2+
level: 6
3+
paths:
4+
- src
5+
- tests
6+
ignoreErrors:
7+
- '#(class|type) Magento\\TestFramework#i'
8+
- '#(class|type) Magento\\\S*Factory#i'
9+
- '#(method) Magento\\Framework\\Api\\ExtensionAttributesInterface#i'

0 commit comments

Comments
 (0)