Skip to content

Commit

Permalink
CI setup for running tests in drone
Browse files Browse the repository at this point in the history
Implement style check for owncloud coding standard
Add make targets for running tests
Add `.drone.yml` file for drone configurations
  • Loading branch information
dpakach committed Nov 26, 2018
1 parent 2bbb071 commit 3f7b946
Show file tree
Hide file tree
Showing 9 changed files with 514 additions and 10 deletions.
281 changes: 281 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
workspace:
base: /var/www/owncloud
path: apps/announcementcenter

branches: [master, release*, release/*]

pipeline:
install-server:
image: owncloudci/core
version: ${OC_VERSION}
pull: true
db_type: ${DB_TYPE}
db_name: ${DB_NAME}
db_host: ${DB_TYPE}
db_username: autotest
db_password: owncloud
when:
matrix:
NEED_SERVER: true

install-app:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- cd /var/www/owncloud/
- php occ a:l
- php occ a:e announcementcenter
- php occ a:e testing
- php occ a:l
- php occ config:system:set trusted_domains 1 --value=owncloud
- php occ log:manage --level 0
when:
matrix:
NEED_INSTALL_APP: true

fix-permissions:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- chown www-data /var/www/owncloud -R
- chmod 777 /var/www/owncloud/tests/acceptance/filesForUpload -R
- chmod +x /var/www/owncloud/tests/acceptance/run.sh
when:
matrix:
NEED_SERVER: true

owncloud-log:
image: owncloud/ubuntu:16.04
detach: true
pull: true
commands:
- tail -f /var/www/owncloud/data/owncloud.log
when:
matrix:
NEED_SERVER: true

owncloud-coding-standard:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- make test-php-style
when:
matrix:
TEST_SUITE: owncloud-coding-standard

codecheck-test:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- su-exec www-data make test-codecheck
when:
matrix:
TEST_SUITE: codecheck

codecheck-deprecations-test:
image: owncloudci/php:${PHP_VERSION}
pull: true
commands:
- su-exec www-data make test-codecheck-deprecations
when:
matrix:
TEST_SUITE: codecheck-deprecations

phpunit-tests:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- PHP_VERSION=${PHP_VERSION}
- COVERAGE=${COVERAGE}
commands:
- if [ -z "${COVERAGE}" ]; then make test-php-unit; fi
- if [ "${COVERAGE}" = "true" ]; then make test-php-unit-dbg; fi
when:
matrix:
TEST_SUITE: phpunit

codecov:
image: plugins/codecov:2
secrets: [codecov_token]
pull: true
files:
- tests/output/clover.xml
when:
matrix:
COVERAGE: true

notify:
image: plugins/slack:1
pull: true
secrets: [ slack_webhook ]
channel: builds
when:
status: [ failure, changed ]
event: [ push, tag ]

services:
mysql:
image: mysql:5.5
environment:
- MYSQL_USER=autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=${DB_NAME}
- MYSQL_ROOT_PASSWORD=owncloud
when:
matrix:
DB_TYPE: mysql

pgsql:
image: postgres:9.4
environment:
- POSTGRES_USER=autotest
- POSTGRES_PASSWORD=owncloud
- POSTGRES_DB=${DB_NAME}
when:
matrix:
DB_TYPE: pgsql

oci:
image: deepdiver/docker-oracle-xe-11g
environment:
- ORACLE_USER=system
- ORACLE_PASSWORD=oracle
- ORACLE_DB=${DB_NAME}
when:
matrix:
DB_TYPE: oci

owncloud:
image: owncloudci/php:${PHP_VERSION}
pull: true
environment:
- APACHE_WEBROOT=/var/www/owncloud/
command: [ "/usr/local/bin/apachectl", "-e", "debug", "-D", "FOREGROUND" ]
when:
matrix:
NEED_SERVER: true

matrix:
include:
# code check tests
- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: codecheck
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: codecheck-deprecations
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: codecheck
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: codecheck-deprecations
NEED_SERVER: true
NEED_INSTALL_APP: true

# Unit Tests
- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: oci
DB_NAME: XE
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-master-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: sqlite
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 5.6
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: pgsql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true
COVERAGE: true

- PHP_VERSION: 7.0
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: oci
DB_NAME: XE
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.1
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true

- PHP_VERSION: 7.2
OC_VERSION: daily-stable10-qa
TEST_SUITE: phpunit
DB_TYPE: mysql
DB_NAME: owncloud
NEED_SERVER: true
NEED_INSTALL_APP: true
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ nbproject
# Tests - auto-generated files
/tests/coverage*
/tests/clover.xml
/tests/output/clover.xml
/tests/js/node_modules
/tests/output/

build

.php_cs.cache

# Composer
composer.phar
vendor/
vendor-bin/**/composer.lock
vendor-bin/**/vendor
14 changes: 14 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

$config = new OC\CodingStandard\Config();

$config
->setUsingCache(true)
->getFinder()
->exclude('l10n')
->exclude('vendor')
->exclude('vendor-bin')
->notPath('/^c3.php/')
->in(__DIR__);

return $config;
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ script:
- cd apps/$APP_NAME/

# Run phpunit tests
- cd tests/
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then ../../../lib/composer/bin/phpunit --configuration phpunit.xml; fi"
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then make test-php-unit; fi"

# Create coverage report
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then wget https://scrutinizer-ci.com/ocular.phar; fi"
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php ocular.phar code-coverage:upload --format=php-clover clover.xml; fi"
- cd ../
- sh -c "if [ '$JSTESTS' != '1' -a '$CODECHECK' != '1' -a '$CODECHECK' != '2' ]; then php ocular.phar code-coverage:upload --format=php-clover ./tests/output/clover.xml; fi"

after_success:
- bash <(curl -s https://codecov.io/bash)
Expand Down
Loading

0 comments on commit 3f7b946

Please sign in to comment.