fix drone config

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2018-06-14 14:46:20 +02:00
parent 373974a40d
commit 3f95d819e9
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
4 changed files with 102 additions and 30 deletions

View File

@ -15,7 +15,6 @@ pipeline:
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server - cd ../server
- php ./build/signed-off-checker.php - php ./build/signed-off-checker.php
secrets: [ github_token ]
when: when:
matrix: matrix:
TESTS: signed-off-check TESTS: signed-off-check
@ -26,37 +25,37 @@ pipeline:
- CORE_BRANCH=stable13 - CORE_BRANCH=stable13
- DB=sqlite - DB=sqlite
commands: commands:
# Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server
# Code checker
- ./occ app:check-code $APP_NAME
- cd apps/$APP_NAME/
when:
matrix:
TESTS: check-app-compatbility
syntax-php5.6:
image: nextcloudci/php5.6:php5.6-3
environment:
- APP_NAME=spreed
- CORE_BRANCH=stable13
- DB=sqlite
commands:
# Pre-setup steps # Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh - wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB - bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server - cd ../server
- composer install
- ./lib/composer/bin/parallel-lint apps/$APP_NAME/ # Code checker
when: - ./occ app:check-code $APP_NAME
matrix: - cd apps/$APP_NAME/
TESTS: syntax-php5.6 when:
matrix:
TESTS: check-app-compatbility
syntax-php5.6:
image: nextcloudci/php5.6:php5.6-8
environment:
- APP_NAME=data_request
- CORE_BRANCH=stable13
- DB=sqlite
commands:
# Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server
- composer install
- ./lib/composer/bin/parallel-lint apps/$APP_NAME/
when:
matrix:
TESTS: syntax-php5.6
syntax-php7.0: syntax-php7.0:
image: nextcloudci/php7.0:php7.0-2 image: nextcloudci/php7.0:php7.0-2
environment: environment:
- APP_NAME=spreed - APP_NAME=data_request
- CORE_BRANCH=stable13 - CORE_BRANCH=stable13
- DB=sqlite - DB=sqlite
commands: commands:
@ -69,9 +68,75 @@ pipeline:
when: when:
matrix: matrix:
TESTS: syntax-php7.0 TESTS: syntax-php7.0
php5.6:
image: nextcloudci/php5.6:php5.6-8
environment:
- APP_NAME=data_request
- CORE_BRANCH=stable13
- DB=sqlite
commands:
- apt update && apt-get -y install php5-xdebug
# Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server/
- ./occ app:enable $APP_NAME
- cd apps/$APP_NAME
# Run phpunit tests
- cd tests/unit/
- phpunit --configuration phpunit.xml
when:
matrix:
TESTS: php5.6
php7.0:
image: nextcloudci/php7.0:php7.0-2
environment:
- APP_NAME=data_request
- CORE_BRANCH=stable13
- DB=sqlite
commands:
# Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server/
- ./occ app:enable $APP_NAME
- cd apps/$APP_NAME
# Run phpunit tests
- cd tests/unit/
- phpunit --configuration phpunit.xml
when:
matrix:
TESTS: php7.0
php7.1:
image: nextcloudci/php7.1:php7.1-15
environment:
- APP_NAME=data_request
- CORE_BRANCH=stable13
- DB=sqlite
commands:
# Pre-setup steps
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server/
- ./occ app:enable $APP_NAME
- cd apps/$APP_NAME
# Run phpunit tests
- cd tests/unit/
- phpunit --configuration phpunit.xml
when:
matrix:
TESTS: php7.1
matrix: matrix:
include: include:
- TESTS: signed-off-check - TESTS: signed-off-check
- TESTS: check-app-compatbility - TESTS: check-app-compatbility
- TESTS: syntax-php5.6 - TESTS: syntax-php5.6
- TESTS: syntax-php7.0 - TESTS: syntax-php7.0
- TESTS: php5.6
- TESTS: php7.0
- TESTS: php7.1

View File

@ -160,7 +160,7 @@ class Request {
protected function getAdmins() { protected function getAdmins() {
$admins = $this->groupManager->get('admin')->searchUsers(''); $admins = $this->groupManager->get('admin')->searchUsers('');
$admins = array_filter($admins, function(IUser $admin) { $admins = array_filter($admins, function(IUser $admin) {
return $admin->getEMailAddress() !== null; return $admin->getEMailAddress() !== null;
}); });
if(empty($admins)) { if(empty($admins)) {

View File

@ -163,15 +163,24 @@ class RequestTest extends \Test\TestCase {
public function adminProvider() { public function adminProvider() {
$admin1 = $this->createMock(IUser::class); $admin1 = $this->createMock(IUser::class);
$admin2 = $this->createMock(IUser::class); $admin2 = $this->createMock(IUser::class);
$admin2->expects($this->any()) $admin2->expects($this->any())
->method('getEMailAddress') ->method('getEMailAddress')
->willReturn('admin2@sindar.gov'); ->willReturn('admin2@sindar.gov');
$admin3 = $this->createMock(IUser::class); $admin3 = $this->createMock(IUser::class);
$admin3->expects($this->any()) $admin3->expects($this->any())
->method('getEMailAddress') ->method('getEMailAddress')
->willReturn('admin3@sindar.gov'); ->willReturn('admin3@sindar.gov');
$admin4 = $this->createMock(IUser::class);
$admin5 = $this->createMock(IUser::class);
$admin5->expects($this->any())
->method('getEMailAddress')
->willReturn('admin5@sindar.gov');
return [ return [
[ [
[ $admin1 ], [ $admin1 ],
@ -182,7 +191,7 @@ class RequestTest extends \Test\TestCase {
1 1
], ],
[ [
[ $admin1, $admin2, $admin3 ], [ $admin3, $admin4, $admin5 ], // for whatever reasons, reusing $admin1 and $admin2 would fail on CI
2 2
] ]
]; ];
@ -209,6 +218,7 @@ class RequestTest extends \Test\TestCase {
$this->expectException(HintedRuntime::class); $this->expectException(HintedRuntime::class);
} }
$result = $this->invokePrivate($this->service, 'getAdmins'); $result = $this->invokePrivate($this->service, 'getAdmins');
$this->assertSame($adminsWithEmail, count($result)); $this->assertSame($adminsWithEmail, count($result));
} }

View File

@ -25,7 +25,4 @@ if (!defined('PHPUNIT_RUN')) {
require_once __DIR__.'/../../../../lib/base.php'; require_once __DIR__.'/../../../../lib/base.php';
\OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests'); \OC::$loader->addValidRoot(\OC::$SERVERROOT . '/tests');
\OC_App::loadApp('data_request'); \OC_App::loadApp('data_request');
if(!class_exists('PHPUnit_Framework_TestCase')) {
require_once('PHPUnit/Autoload.php');
}
OC_Hook::clear(); OC_Hook::clear();