Move to github workflow

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2021-07-07 09:23:30 +02:00
parent 0435b02a99
commit 9179c1f426
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
7 changed files with 4393 additions and 152 deletions

View file

@ -1,131 +0,0 @@
pipeline:
signed-off-check:
image: nextcloudci/php7.0:php7.0-2
environment:
- APP_NAME=circles
- CORE_BRANCH=master
- DB=sqlite
commands:
- wget https://raw.githubusercontent.com/nextcloud/travis_ci/master/before_install.sh
- bash ./before_install.sh $APP_NAME $CORE_BRANCH $DB
- cd ../server
- php ./build/signed-off-checker.php
secrets: [ github_token ]
when:
matrix:
TESTS: signed-off-check
phpunit-sqlite-php7.0:
image: nextcloudci/php7.0:php7.0-2
environment:
- APP_NAME=circles
- CORE_BRANCH=master
- DB=sqlite
commands:
- 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/tests/
# phpunit
- phpunit --configuration phpunit.xml
# codecov
- wget https://codecov.io/bash -O codecov.sh
- sh -c "if [ '$DRONE_BUILD_EVENT' = 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -P $DRONE_PULL_REQUEST -t ff710fa8-260c-4a61-bdd3-0771d6aea5b5; fi"
- sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t ff710fa8-260c-4a61-bdd3-0771d6aea5b5; fi"
when:
matrix:
TESTS: phpunit-sqlite-php7.0
phpunit-sqlite-php5.6:
image: nextcloudci/php5.6:php5.6-3
environment:
- APP_NAME=circles
- CORE_BRANCH=master
- DB=sqlite
commands:
# Pre-setup steps
- apt update && apt-get -y install php5-xdebug
- 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/tests/
# phpunit
- phpunit --configuration phpunit.xml
when:
matrix:
TESTS: phpunit-sqlite-php5.6
sqlite-php7.1:
image: nextcloudci/php7.1:php7.1-11
environment:
- APP_NAME=circles
- CORE_BRANCH=master
- DB=sqlite
commands:
# Pre-setup steps
- yum -y install wget
- 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/tests/
# phpunit
- phpunit --configuration phpunit.xml
when:
matrix:
DB: sqlite
PHP: 7.1
services:
cache:
image: redis
postgres:
image: postgres
environment:
- POSTGRES_USER=oc_autotest
- POSTGRES_PASSWORD=oc_autotest
when:
matrix:
DB: pgsql
mysql:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=owncloud
- MYSQL_USER=oc_autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=oc_autotest
when:
matrix:
DB: mysql
mysqlmb4:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=owncloud
- MYSQL_USER=oc_autotest
- MYSQL_PASSWORD=owncloud
- MYSQL_DATABASE=oc_autotest
command: [ "--innodb_large_prefix=true", "--innodb_file_format=barracuda", "--innodb_file_per_table=true" ]
when:
matrix:
DB: mysqlmb4
matrix:
include:
- TESTS: signed-off-check
- TESTS: phpunit-sqlite-php7.0
- TESTS: phpunit-sqlite-php5.6
# - TESTS: mysql-php7.0
# - TESTS: sqlite-php7.1
# - TESTS: mysql-php7.1
# - TESTS: sqlite-php5.6
- DB: sqlite
PHP: 7.1
# - TESTS: mysql-php5.6

202
.github/workflows/phpunit.yml vendored Normal file
View file

@ -0,0 +1,202 @@
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
APP_NAME: circles
jobs:
php:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ["8.0"]
databases: ["sqlite"]
server-versions: ["master"]
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
submodules: true
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, sqlite, pdo_sqlite, gd, zip
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit & coverage
working-directory: apps/${{ env.APP_NAME }}/tests
run: ../vendor/phpunit/phpunit/phpunit --coverage-clover coverage.xml -c phpunit.xml
# - name: PHPUnit integration
# working-directory: apps/${{ env.APP_NAME }}
# run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
- name: Upload coverage
working-directory: apps/${{ env.APP_NAME }}/tests
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
mysql:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ["7.3", "7.4", "8.0"]
databases: ["mysql"]
server-versions: ["master"]
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
services:
mysql:
image: mariadb
ports:
- 4444:3306/tcp
env:
MYSQL_ROOT_PASSWORD: rootpassword
options: --health-cmd="mysqladmin ping" --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
submodules: true
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, mysql, pdo_mysql, gd, zip
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}/tests
run: ../vendor/phpunit/phpunit/phpunit -c phpunit.xml
# - name: PHPUnit integration
# working-directory: apps/${{ env.APP_NAME }}
# run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml
pgsql:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ["8.0"]
databases: ["pgsql"]
server-versions: ["master"]
name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
services:
postgres:
image: postgres
ports:
- 4444:5432/tcp
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: rootpassword
POSTGRES_DB: nextcloud
options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
steps:
- name: Checkout server
uses: actions/checkout@v2
with:
repository: nextcloud/server
ref: ${{ matrix.server-versions }}
submodules: true
- name: Checkout app
uses: actions/checkout@v2
with:
path: apps/${{ env.APP_NAME }}
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
extensions: mbstring, iconv, fileinfo, intl, pgsql, pdo_pgsql, gd, zip
coverage: none
- name: Set up PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
./occ maintenance:install --verbose --database=${{ matrix.databases }} --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass password
./occ app:enable --force ${{ env.APP_NAME }}
php -S localhost:8080 &
- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}/tests
run: ../vendor/phpunit/phpunit/phpunit -c phpunit.xml
# - name: PHPUnit integration
# working-directory: apps/${{ env.APP_NAME }}
# run: ./vendor/phpunit/phpunit/phpunit -c phpunit.integration.xml

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
build/
.settings/
vendor/
.php_cs.cache

18
.php_cs.dist Normal file
View file

@ -0,0 +1,18 @@
<?php
declare(strict_types=1);
require_once './vendor/autoload.php';
use Nextcloud\CodingStandard\Config;
$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->in(__DIR__);
return $config;

View file

@ -6,7 +6,10 @@
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"autoloader-suffix": "Circles"
"autoloader-suffix": "Circles",
"platform": {
"php": "7.3"
}
},
"authors": [
{
@ -21,5 +24,14 @@
},
"require": {
"artificial-owl/my-small-php-tools": "~22"
},
"scripts": {
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l"
},
"require-dev": {
"nextcloud/coding-standard": "^0.5.0",
"phpunit/phpunit": "^9.5"
}
}
}

4158
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,22 +1,9 @@
<?php
use OCA\Circles\AppInfo\Application;
if (!defined('PHPUNIT_RUN')) {
define('PHPUNIT_RUN', 1);
}
require_once __DIR__.'/../../../lib/base.php';
require_once __DIR__.'/../vendor/autoload.php';
require_once __DIR__ . '/../../../lib/base.php';
// Fix for "Autoload path not allowed: .../tests/lib/testcase.php"
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
\OC_App::loadApp(Application::APP_ID);
if (!class_exists('PHPUnit_Framework_TestCase')) {
require_once('PHPUnit/Autoload.php');
}
OC_Hook::clear();
\OC_App::loadApp('circles');