mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-22 05:06:07 +03:00
Merge pull request #175 from iyzoer/master
Update travis configuration, deployment to Github releases
This commit is contained in:
commit
24cc5e57a6
2
.gitignore
vendored
2
.gitignore
vendored
@ -6,4 +6,4 @@
|
|||||||
/vendor
|
/vendor
|
||||||
/www
|
/www
|
||||||
/bin
|
/bin
|
||||||
.env
|
tests/.env
|
||||||
|
80
.travis.yml
80
.travis.yml
@ -4,9 +4,7 @@ dist: trusty
|
|||||||
|
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
php:
|
if: tag IS blank
|
||||||
- 7.0
|
|
||||||
- 7.1
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
@ -21,24 +19,64 @@ env:
|
|||||||
- SERVER_PORT=8000
|
- SERVER_PORT=8000
|
||||||
- SERVER_URL=http://localhost
|
- SERVER_URL=http://localhost
|
||||||
|
|
||||||
before_script:
|
stages:
|
||||||
# Change MySQL root password
|
- test
|
||||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
- deploy
|
||||||
|
|
||||||
- composer install
|
before_install:
|
||||||
- composer setup
|
- export LAST_TAG=`git describe --abbrev=0 --tags`
|
||||||
- bin/robo project:deploy
|
- export CURRENT_VERSION=v`cat VERSION`
|
||||||
- (php -S localhost:8000 -t www &) 2> /dev/null > /dev/null
|
|
||||||
- sleep 2
|
|
||||||
|
|
||||||
script:
|
before_script: make before_script
|
||||||
- composer test
|
|
||||||
|
|
||||||
deploy:
|
script: composer test
|
||||||
skip_cleanup: true
|
|
||||||
provider: script
|
after_success:
|
||||||
script: make
|
- make coverage
|
||||||
on:
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
php: 7.1
|
|
||||||
branch: master
|
jobs:
|
||||||
condition: "$DEPLOY = true"
|
include:
|
||||||
|
- php: 7.0
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=2.3
|
||||||
|
- OPENCART=2.3
|
||||||
|
- php: 7.1
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=2.3
|
||||||
|
- OPENCART=2.3
|
||||||
|
- php: 7.0
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=3.0
|
||||||
|
- OPENCART=3.0
|
||||||
|
- php: 7.1
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=3.0
|
||||||
|
- OPENCART=3.0
|
||||||
|
- php: 7.2
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=3.0
|
||||||
|
- OPENCART=3.0
|
||||||
|
- php: 7.3
|
||||||
|
env:
|
||||||
|
- TEST_SUITE=3.0
|
||||||
|
- OPENCART=3.0
|
||||||
|
- stage: deploy
|
||||||
|
before_script: skip
|
||||||
|
script: make build_archive
|
||||||
|
before_deploy:
|
||||||
|
- export VERSION=`cat VERSION`
|
||||||
|
- export ARCHIVE_NAME=/tmp/retailcrm-$VERSION.ocmod.zip
|
||||||
|
- git config --local user.name "retailCRM"
|
||||||
|
- git config --local user.email "support@retailcrm.ru"
|
||||||
|
- export TRAVIS_TAG=v$VERSION
|
||||||
|
- git tag $TRAVIS_TAG
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key: $GITHUB_OAUTH_TOKEN
|
||||||
|
skip_cleanup: true
|
||||||
|
file: $ARCHIVE_NAME
|
||||||
|
on:
|
||||||
|
condition: "$LAST_TAG != $CURRENT_VERSION"
|
||||||
|
if: branch = master AND type = push AND fork = false
|
||||||
|
after_deploy: make delete_archive
|
@ -1,3 +1,6 @@
|
|||||||
|
## v.3.3.7
|
||||||
|
* Изменена конфигурация travis-ci для сборки и развертывания
|
||||||
|
|
||||||
## v.3.3.6
|
## v.3.3.6
|
||||||
* Небольшие фиксы
|
* Небольшие фиксы
|
||||||
|
|
||||||
|
18
Makefile
18
Makefile
@ -1,6 +1,6 @@
|
|||||||
FILE = $(TRAVIS_BUILD_DIR)/VERSION
|
FILE = $(TRAVIS_BUILD_DIR)/VERSION
|
||||||
VERSION = `cat $(FILE)`
|
VERSION = `cat $(FILE)`
|
||||||
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip'
|
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.ocmod.zip'
|
||||||
|
|
||||||
all: build_archive send_to_ftp delete_archive
|
all: build_archive send_to_ftp delete_archive
|
||||||
|
|
||||||
@ -11,4 +11,18 @@ send_to_ftp:
|
|||||||
curl -T $(ARCHIVE_NAME) -u $(FTP_USER):$(FTP_PASSWORD) ftp://$(FTP_HOST)
|
curl -T $(ARCHIVE_NAME) -u $(FTP_USER):$(FTP_PASSWORD) ftp://$(FTP_HOST)
|
||||||
|
|
||||||
delete_archive:
|
delete_archive:
|
||||||
rm -f $(ARCHIVE_NAME)
|
rm -f $(ARCHIVE_NAME)
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
mkdir coverage
|
||||||
|
# Change MySQL root password
|
||||||
|
echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||||
|
composer require --dev beyondit/opencart-test-suite ~$(TEST_SUITE)
|
||||||
|
composer require --dev opencart/opencart ~$(OPENCART)
|
||||||
|
composer setup
|
||||||
|
bin/robo --load-from tests/RoboFile.php project:deploy
|
||||||
|
(php -S localhost:8000 -t www &) 2> /dev/null > /dev/null
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
wget https://phar.phpunit.de/phpcov-2.0.2.phar && php phpcov-2.0.2.phar merge coverage/ --clover coverage.xml
|
||||||
|
@ -9,14 +9,6 @@
|
|||||||
"email": "integration@retailcrm.ru"
|
"email": "integration@retailcrm.ru"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require-dev": {
|
|
||||||
"opencart/opencart" : "2.3.0.2",
|
|
||||||
"vlucas/phpdotenv": "~1.1.0",
|
|
||||||
"phpunit/phpunit" : "~4.0",
|
|
||||||
"beyondit/opencart-test-suite": "~2.3.0",
|
|
||||||
"consolidation/robo": "~1",
|
|
||||||
"henrikbjorn/lurker": "^1.2"
|
|
||||||
},
|
|
||||||
"config": {
|
"config": {
|
||||||
"bin-dir": "bin/",
|
"bin-dir": "bin/",
|
||||||
"preferred-install": "source"
|
"preferred-install": "source"
|
||||||
@ -25,12 +17,15 @@
|
|||||||
"opencart-dir" : "www"
|
"opencart-dir" : "www"
|
||||||
},
|
},
|
||||||
"scripts" : {
|
"scripts" : {
|
||||||
"test-admin": "bin/phpunit --testsuite admin-tests --colors=always",
|
"test-admin": "bin/phpunit --coverage-php coverage/admin.cov --testsuite admin-tests --colors=always",
|
||||||
"test-catalog": "bin/phpunit --testsuite catalog-tests --colors=always",
|
"test-catalog": "bin/phpunit --coverage-php coverage/catalog.cov --testsuite catalog-tests --colors=always",
|
||||||
"test": [
|
"test": [
|
||||||
"@test-admin",
|
"@test-admin",
|
||||||
"@test-catalog"
|
"@test-catalog"
|
||||||
],
|
],
|
||||||
"setup" : "bin/robo opencart:setup"
|
"setup" : "bin/robo --load-from tests/RoboFile.php opencart:setup"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"consolidation/robo": "~1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
3197
composer.lock
generated
3197
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@ -19,5 +19,17 @@
|
|||||||
</testsuites>
|
</testsuites>
|
||||||
<php>
|
<php>
|
||||||
<env name="OC_ROOT" value="./www/" />
|
<env name="OC_ROOT" value="./www/" />
|
||||||
|
<env name="HTTP_SERVER" value="http://localhost:8000/" />
|
||||||
|
<env name="TEST_CONFIG" value="test-config" />
|
||||||
</php>
|
</php>
|
||||||
|
<filter>
|
||||||
|
<whitelist>
|
||||||
|
<directory suffix="retailcrm.php">./www/admin/controller</directory>
|
||||||
|
<directory>./www/admin/model/extension/retailcrm</directory>
|
||||||
|
<directory suffix="retailcrm.php">./www/catalog/controller</directory>
|
||||||
|
<directory suffix="daemon_collector.php">./www/catalog/controller</directory>
|
||||||
|
<directory>./www/catalog/model/extension/retailcrm</directory>
|
||||||
|
<directory suffix=".php">./www/system/library/retailcrm</directory>
|
||||||
|
</whitelist>
|
||||||
|
</filter>
|
||||||
</phpunit>
|
</phpunit>
|
5
tests/2.3/TestCase.php
Normal file
5
tests/2.3/TestCase.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class TestCase extends OpenCartTest
|
||||||
|
{
|
||||||
|
}
|
5
tests/3.0/TestCase.php
Normal file
5
tests/3.0/TestCase.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class TestCase extends \Tests\OpenCartTest
|
||||||
|
{
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('vendor/autoload.php');
|
require_once(__DIR__.'/../vendor/autoload.php');
|
||||||
if (file_exists(__DIR__.'/.env')) {
|
if (file_exists(__DIR__ . '/.env')) {
|
||||||
Dotenv::load(__DIR__);
|
Dotenv::load(__DIR__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,6 +25,8 @@ class RoboFile extends \Robo\Tasks
|
|||||||
*/
|
*/
|
||||||
private $server_url = 'http://localhost';
|
private $server_url = 'http://localhost';
|
||||||
|
|
||||||
|
private $root_dir = __DIR__ . '/../';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
if ($_ENV) {
|
if ($_ENV) {
|
||||||
@ -72,10 +74,19 @@ class RoboFile extends \Robo\Tasks
|
|||||||
{
|
{
|
||||||
$this->taskDeleteDir('www')->run();
|
$this->taskDeleteDir('www')->run();
|
||||||
$this->taskFileSystemStack()
|
$this->taskFileSystemStack()
|
||||||
->mirror('vendor/opencart/opencart/upload', 'www')
|
->mirror(
|
||||||
->copy('vendor/beyondit/opencart-test-suite/src/upload/system/config/test-config.php','www/system/config/test-config.php')
|
$this->root_dir . 'vendor/opencart/opencart/upload',
|
||||||
->copy('vendor/beyondit/opencart-test-suite/src/upload/catalog/controller/startup/test_startup.php','www/catalog/controller/startup/test_startup.php')
|
$this->root_dir . 'www'
|
||||||
->chmod('www', 0777, 0000, true)
|
)
|
||||||
|
->copy(
|
||||||
|
$this->root_dir . 'vendor/beyondit/opencart-test-suite/src/upload/system/config/test-config.php',
|
||||||
|
$this->root_dir . 'www/system/config/test-config.php'
|
||||||
|
)
|
||||||
|
->copy(
|
||||||
|
$this->root_dir . 'vendor/beyondit/opencart-test-suite/src/upload/catalog/controller/startup/test_startup.php',
|
||||||
|
$this->root_dir . 'www/catalog/controller/startup/test_startup.php'
|
||||||
|
)
|
||||||
|
->chmod($this->root_dir . 'www', 0777, 0000, true)
|
||||||
->run();
|
->run();
|
||||||
|
|
||||||
// Create new database, drop if exists already
|
// Create new database, drop if exists already
|
||||||
@ -90,12 +101,12 @@ class RoboFile extends \Robo\Tasks
|
|||||||
$this->printTaskError("<error> Could not connect ot database...");
|
$this->printTaskError("<error> Could not connect ot database...");
|
||||||
}
|
}
|
||||||
|
|
||||||
$install = $this->taskExec('php')->arg('www/install/cli_install.php')->arg('install');
|
$install = $this->taskExec('php')->arg($this->root_dir . 'www/install/cli_install.php')->arg('install');
|
||||||
foreach ($this->opencart_config as $option => $value) {
|
foreach ($this->opencart_config as $option => $value) {
|
||||||
$install->option($option, $value);
|
$install->option($option, $value);
|
||||||
}
|
}
|
||||||
$install->run();
|
$install->run();
|
||||||
$this->taskDeleteDir('www/install')->run();
|
$this->taskDeleteDir($this->root_dir . 'www/install')->run();
|
||||||
|
|
||||||
$this->restoreSampleData($conn);
|
$this->restoreSampleData($conn);
|
||||||
|
|
||||||
@ -105,14 +116,14 @@ class RoboFile extends \Robo\Tasks
|
|||||||
public function opencartRun()
|
public function opencartRun()
|
||||||
{
|
{
|
||||||
$this->taskServer($this->server_port)
|
$this->taskServer($this->server_port)
|
||||||
->dir('www')
|
->dir($this->root_dir . 'www')
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function projectDeploy()
|
public function projectDeploy()
|
||||||
{
|
{
|
||||||
$this->taskFileSystemStack()
|
$this->taskFileSystemStack()
|
||||||
->mirror('src/upload', 'www')
|
->mirror($this->root_dir . 'src/upload', $this->root_dir . 'www')
|
||||||
// ->copy('src/install.xml','www/system/install.ocmod.xml') if exist modification for OCMOD
|
// ->copy('src/install.xml','www/system/install.ocmod.xml') if exist modification for OCMOD
|
||||||
->run();
|
->run();
|
||||||
}
|
}
|
||||||
@ -122,10 +133,10 @@ class RoboFile extends \Robo\Tasks
|
|||||||
$this->projectDeploy();
|
$this->projectDeploy();
|
||||||
|
|
||||||
$this->taskWatch()
|
$this->taskWatch()
|
||||||
->monitor('composer.json', function () {
|
->monitor($this->root_dir . 'composer.json', function () {
|
||||||
$this->taskComposerUpdate()->run();
|
$this->taskComposerUpdate()->run();
|
||||||
$this->projectDeploy();
|
$this->projectDeploy();
|
||||||
})->monitor('src/', function () {
|
})->monitor($this->root_dir . 'src/', function () {
|
||||||
$this->projectDeploy();
|
$this->projectDeploy();
|
||||||
})->run();
|
})->run();
|
||||||
}
|
}
|
||||||
@ -157,7 +168,7 @@ class RoboFile extends \Robo\Tasks
|
|||||||
|
|
||||||
private function restoreSampleData($conn)
|
private function restoreSampleData($conn)
|
||||||
{
|
{
|
||||||
$sql = file_get_contents('tests/opencart_sample_data.sql');
|
$sql = file_get_contents($this->root_dir . 'tests/opencart_sample_data.sql');
|
||||||
|
|
||||||
$conn->exec("USE " . $this->opencart_config['db_database']);
|
$conn->exec("USE " . $this->opencart_config['db_database']);
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ControllerRetailcrmAdminTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ControllerRetailcrmAdminTest extends TestCase
|
||||||
{
|
{
|
||||||
const MODULE_TITLE = 'retailcrm';
|
const MODULE_TITLE = 'retailcrm';
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmCustomerAdminTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmCustomerAdminTest extends TestCase
|
||||||
{
|
{
|
||||||
private $customerModel;
|
private $customerModel;
|
||||||
private $apiClientMock;
|
private $apiClientMock;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmEventAdminTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmEventAdminTest extends TestCase
|
||||||
{
|
{
|
||||||
const CODE = 'test';
|
const CODE = 'test';
|
||||||
|
|
||||||
protected function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmOrderAdminTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmOrderAdminTest extends TestCase
|
||||||
{
|
{
|
||||||
private $orderModel;
|
private $orderModel;
|
||||||
private $apiClientMock;
|
private $apiClientMock;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmPricesAdminTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmPricesAdminTest extends TestCase
|
||||||
{
|
{
|
||||||
private $pricesModel;
|
private $pricesModel;
|
||||||
private $apiClientMock;
|
private $apiClientMock;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ControllerRetailcrmApiCatalogTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ControllerRetailcrmApiCatalogTest extends TestCase
|
||||||
{
|
{
|
||||||
private $apiKey;
|
private $apiKey;
|
||||||
private $retailcrm;
|
private $retailcrm;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmCustomerCatalogTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmCustomerCatalogTest extends TestCase
|
||||||
{
|
{
|
||||||
private $customerModel;
|
private $customerModel;
|
||||||
private $apiClientMock;
|
private $apiClientMock;
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class ModelRetailcrmOrderCatalogTest extends OpenCartTest
|
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||||
|
|
||||||
|
class ModelRetailcrmOrderCatalogTest extends TestCase
|
||||||
{
|
{
|
||||||
private $orderModel;
|
private $orderModel;
|
||||||
private $apiClientMock;
|
private $apiClientMock;
|
||||||
|
Loading…
Reference in New Issue
Block a user