Merge pull request #31 from nextcloud/ci_travis_drone

.travis.yml and .drone.yml to make automatic CI tests work
This commit is contained in:
violoncello.ch
2019-02-27 23:18:43 +01:00
committed by GitHub
4 changed files with 126 additions and 0 deletions

29
.drone.yml Normal file
View File

@@ -0,0 +1,29 @@
clone:
git:
image: plugins/git
depth: 1
pipeline:
check-app-compatbility:
image: nextcloudci/php7.2:php7.2-9
environment:
- APP_NAME=user_external
- CORE_BRANCH=master
- 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
# Code checker
- ./occ app:check-code $APP_NAME -c strong-comparison
- ./occ app:check-code $APP_NAME -c deprecation
- cd apps/$APP_NAME/
when:
matrix:
TESTS: check-app-compatbility
matrix:
include:
- TESTS: check-app-compatbility

52
.travis.yml Normal file
View File

@@ -0,0 +1,52 @@
language: php
php:
- 7.1
- 7.2
- 7.3
env:
global:
- APP_NAME=user_external
- PHP_COVERAGE=FALSE
matrix:
# - DB=sqlite SERVER=nextcloud/travis_ci/master SERVER_BRANCH=master
- DB=sqlite SERVER=nextcloud/travis_ci/master SERVER_BRANCH=stable15
# - DB=mysql SERVER=nextcloud/travis_ci/master SERVER_BRANCH=master PHP_COVERAGE=TRUE
- DB=mysql SERVER=nextcloud/travis_ci/master SERVER_BRANCH=stable15 PHP_COVERAGE=TRUE
# - DB=pgsql SERVER=nextcloud/travis_ci/master SERVER_BRANCH=master
- DB=pgsql SERVER=nextcloud/travis_ci/master SERVER_BRANCH=stable15
matrix:
fast_finish: true
branches:
only:
- master
- /^stable\d+(\.\d+)?$/
before_install:
- sudo apt-get -qq update
- sudo apt-get install -y libxml2-utils
- wget https://raw.githubusercontent.com/$SERVER/before_install.sh
- . ./before_install.sh "$APP_NAME" "$SERVER_BRANCH" "$DB"
- cd ../core || cd ../server
- php occ app:enable $APP_NAME
before_script:
# Test lint
- cd apps/$APP_NAME
- find . -name \*.php -exec php -l "{}" \;
script:
# Check info.xml schema validity
- wget https://apps.nextcloud.com/schema/apps/info.xsd
- xmllint appinfo/info.xml --schema info.xsd --noout
- rm info.xsd
# Run phpunit tests
# - cd tests
# - phpunit --configuration configuration.xml
# Create coverage report
# - sh -c "if [ '$PHP_COVERAGE' != 'FALSE' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
# - sh -c "if [ '$PHP_COVERAGE' != 'FALSE' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"

15
tests/bootstrap.php Normal file
View File

@@ -0,0 +1,15 @@
<?php
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__ . '/../../../lib/base.php';
if (!class_exists('\PHPUnit\Framework\TestCase')) {
require_once('PHPUnit/Autoload.php');
}
\OC_App::loadApp('user_external');
$dummyClass = \OC::$SERVERROOT . '/tests/lib/Util/User/Dummy.php';
if(file_exists($dummyClass)) {
require_once($dummyClass);
}
OC_Hook::clear();

30
tests/configuration.xml Normal file
View File

@@ -0,0 +1,30 @@
<phpunit bootstrap="bootstrap.php"
verbose="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
>
<testsuites>
<testsuite name="External User Authentication App Tests">
<directory suffix=".php">.</directory>
<exclude>config.php</exclude>
</testsuite>
</testsuites>
<!-- filters for code coverage -->
<filter>
<whitelist>
<directory suffix=".php">../../user_external</directory>
<exclude>
<directory suffix=".php">../../user_external/l10n</directory>
<directory suffix=".php">../../user_external/tests</directory>
</exclude>
</whitelist>
</filter>
<logging>
<!-- and this is where your report will be written -->
<log type="coverage-clover" target="./clover.xml"/>
</logging>
</phpunit>