mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-25 06:36:06 +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
|
||||
/www
|
||||
/bin
|
||||
.env
|
||||
tests/.env
|
||||
|
74
.travis.yml
74
.travis.yml
@ -4,9 +4,7 @@ dist: trusty
|
||||
|
||||
sudo: false
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
if: tag IS blank
|
||||
|
||||
env:
|
||||
global:
|
||||
@ -21,24 +19,64 @@ env:
|
||||
- SERVER_PORT=8000
|
||||
- SERVER_URL=http://localhost
|
||||
|
||||
before_script:
|
||||
# Change MySQL root password
|
||||
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root
|
||||
stages:
|
||||
- test
|
||||
- deploy
|
||||
|
||||
- composer install
|
||||
- composer setup
|
||||
- bin/robo project:deploy
|
||||
- (php -S localhost:8000 -t www &) 2> /dev/null > /dev/null
|
||||
- sleep 2
|
||||
before_install:
|
||||
- export LAST_TAG=`git describe --abbrev=0 --tags`
|
||||
- export CURRENT_VERSION=v`cat VERSION`
|
||||
|
||||
script:
|
||||
- composer test
|
||||
before_script: make before_script
|
||||
|
||||
script: composer test
|
||||
|
||||
after_success:
|
||||
- make coverage
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
|
||||
jobs:
|
||||
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
|
||||
provider: script
|
||||
script: make
|
||||
file: $ARCHIVE_NAME
|
||||
on:
|
||||
php: 7.1
|
||||
branch: master
|
||||
condition: "$DEPLOY = true"
|
||||
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
|
||||
* Небольшие фиксы
|
||||
|
||||
|
16
Makefile
16
Makefile
@ -1,6 +1,6 @@
|
||||
FILE = $(TRAVIS_BUILD_DIR)/VERSION
|
||||
VERSION = `cat $(FILE)`
|
||||
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.zip'
|
||||
ARCHIVE_NAME = '/tmp/retailcrm-'$(VERSION)'.ocmod.zip'
|
||||
|
||||
all: build_archive send_to_ftp delete_archive
|
||||
|
||||
@ -12,3 +12,17 @@ send_to_ftp:
|
||||
|
||||
delete_archive:
|
||||
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"
|
||||
}
|
||||
],
|
||||
"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": {
|
||||
"bin-dir": "bin/",
|
||||
"preferred-install": "source"
|
||||
@ -25,12 +17,15 @@
|
||||
"opencart-dir" : "www"
|
||||
},
|
||||
"scripts" : {
|
||||
"test-admin": "bin/phpunit --testsuite admin-tests --colors=always",
|
||||
"test-catalog": "bin/phpunit --testsuite catalog-tests --colors=always",
|
||||
"test-admin": "bin/phpunit --coverage-php coverage/admin.cov --testsuite admin-tests --colors=always",
|
||||
"test-catalog": "bin/phpunit --coverage-php coverage/catalog.cov --testsuite catalog-tests --colors=always",
|
||||
"test": [
|
||||
"@test-admin",
|
||||
"@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>
|
||||
<php>
|
||||
<env name="OC_ROOT" value="./www/" />
|
||||
<env name="HTTP_SERVER" value="http://localhost:8000/" />
|
||||
<env name="TEST_CONFIG" value="test-config" />
|
||||
</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>
|
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,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once('vendor/autoload.php');
|
||||
require_once(__DIR__.'/../vendor/autoload.php');
|
||||
if (file_exists(__DIR__ . '/.env')) {
|
||||
Dotenv::load(__DIR__);
|
||||
}
|
||||
@ -25,6 +25,8 @@ class RoboFile extends \Robo\Tasks
|
||||
*/
|
||||
private $server_url = 'http://localhost';
|
||||
|
||||
private $root_dir = __DIR__ . '/../';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if ($_ENV) {
|
||||
@ -72,10 +74,19 @@ class RoboFile extends \Robo\Tasks
|
||||
{
|
||||
$this->taskDeleteDir('www')->run();
|
||||
$this->taskFileSystemStack()
|
||||
->mirror('vendor/opencart/opencart/upload', 'www')
|
||||
->copy('vendor/beyondit/opencart-test-suite/src/upload/system/config/test-config.php','www/system/config/test-config.php')
|
||||
->copy('vendor/beyondit/opencart-test-suite/src/upload/catalog/controller/startup/test_startup.php','www/catalog/controller/startup/test_startup.php')
|
||||
->chmod('www', 0777, 0000, true)
|
||||
->mirror(
|
||||
$this->root_dir . 'vendor/opencart/opencart/upload',
|
||||
$this->root_dir . 'www'
|
||||
)
|
||||
->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();
|
||||
|
||||
// Create new database, drop if exists already
|
||||
@ -90,12 +101,12 @@ class RoboFile extends \Robo\Tasks
|
||||
$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) {
|
||||
$install->option($option, $value);
|
||||
}
|
||||
$install->run();
|
||||
$this->taskDeleteDir('www/install')->run();
|
||||
$this->taskDeleteDir($this->root_dir . 'www/install')->run();
|
||||
|
||||
$this->restoreSampleData($conn);
|
||||
|
||||
@ -105,14 +116,14 @@ class RoboFile extends \Robo\Tasks
|
||||
public function opencartRun()
|
||||
{
|
||||
$this->taskServer($this->server_port)
|
||||
->dir('www')
|
||||
->dir($this->root_dir . 'www')
|
||||
->run();
|
||||
}
|
||||
|
||||
public function projectDeploy()
|
||||
{
|
||||
$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
|
||||
->run();
|
||||
}
|
||||
@ -122,10 +133,10 @@ class RoboFile extends \Robo\Tasks
|
||||
$this->projectDeploy();
|
||||
|
||||
$this->taskWatch()
|
||||
->monitor('composer.json', function () {
|
||||
->monitor($this->root_dir . 'composer.json', function () {
|
||||
$this->taskComposerUpdate()->run();
|
||||
$this->projectDeploy();
|
||||
})->monitor('src/', function () {
|
||||
})->monitor($this->root_dir . 'src/', function () {
|
||||
$this->projectDeploy();
|
||||
})->run();
|
||||
}
|
||||
@ -157,7 +168,7 @@ class RoboFile extends \Robo\Tasks
|
||||
|
||||
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']);
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ControllerRetailcrmAdminTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ControllerRetailcrmAdminTest extends TestCase
|
||||
{
|
||||
const MODULE_TITLE = 'retailcrm';
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmCustomerAdminTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmCustomerAdminTest extends TestCase
|
||||
{
|
||||
private $customerModel;
|
||||
private $apiClientMock;
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmEventAdminTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmEventAdminTest extends TestCase
|
||||
{
|
||||
const CODE = 'test';
|
||||
|
||||
protected function setUp()
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmOrderAdminTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmOrderAdminTest extends TestCase
|
||||
{
|
||||
private $orderModel;
|
||||
private $apiClientMock;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmPricesAdminTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmPricesAdminTest extends TestCase
|
||||
{
|
||||
private $pricesModel;
|
||||
private $apiClientMock;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ControllerRetailcrmApiCatalogTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ControllerRetailcrmApiCatalogTest extends TestCase
|
||||
{
|
||||
private $apiKey;
|
||||
private $retailcrm;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmCustomerCatalogTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmCustomerCatalogTest extends TestCase
|
||||
{
|
||||
private $customerModel;
|
||||
private $apiClientMock;
|
||||
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
class ModelRetailcrmOrderCatalogTest extends OpenCartTest
|
||||
require_once __DIR__ . '/../' . getenv('OPENCART') . '/TestCase.php';
|
||||
|
||||
class ModelRetailcrmOrderCatalogTest extends TestCase
|
||||
{
|
||||
private $orderModel;
|
||||
private $apiClientMock;
|
||||
|
Loading…
Reference in New Issue
Block a user