Migrate phpunit and lint to github actions

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ 2021-12-10 09:11:54 +01:00
parent 22ccc12038
commit bea054617a
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
8 changed files with 4121 additions and 343 deletions

View file

@ -1,183 +1,4 @@
kind: pipeline
name: compatibility
clone:
depth: 1
steps:
- name: app-code-check
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
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:check-code $APP_NAME -c strong-comparison -c deprecation
- cd apps/$APP_NAME/
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: compatibility-23
clone:
depth: 1
steps:
- name: app-code-check
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable23
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:check-code $APP_NAME -c strong-comparison -c deprecation
- cd apps/$APP_NAME/
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: compatibility-22
clone:
depth: 1
steps:
- name: app-code-check
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable22
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:check-code $APP_NAME -c strong-comparison -c deprecation
- cd apps/$APP_NAME/
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: compatibility-21
clone:
depth: 1
steps:
- name: app-code-check
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable21
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:check-code $APP_NAME -c strong-comparison -c deprecation
- cd apps/$APP_NAME/
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: tests-master
clone:
depth: 1
steps:
- name: php7.3
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php7.4
image: nextcloudci/php7.4:php7.4-2
environment:
APP_NAME: user_saml
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php8.0
image: nextcloudci/php8.0:latest
environment:
APP_NAME: user_saml
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: integration-tests-master
clone:
@ -211,61 +32,6 @@ trigger:
type: docker
---
kind: pipeline
name: tests-23
clone:
depth: 1
steps:
- name: php7.3
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable23
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php7.4
image: nextcloudci/php7.4:php7.4-2
environment:
APP_NAME: user_saml
CORE_BRANCH: stable23
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php8.0
image: nextcloudci/php8.0:latest
environment:
APP_NAME: user_saml
CORE_BRANCH: stable23
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: integration-tests-stable23
@ -301,61 +67,6 @@ trigger:
type: docker
---
kind: pipeline
name: tests-22
clone:
depth: 1
steps:
- name: php7.3
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable22
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php7.4
image: nextcloudci/php7.4:php7.4-2
environment:
APP_NAME: user_saml
CORE_BRANCH: stable22
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php8.0
image: nextcloudci/php8.0:latest
environment:
APP_NAME: user_saml
CORE_BRANCH: stable22
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---
kind: pipeline
name: integration-tests-stable22
@ -389,60 +100,6 @@ trigger:
- pull_request
- push
type: docker
---
kind: pipeline
name: tests-21
clone:
depth: 1
steps:
- name: php7.3
image: nextcloudci/php7.3:php7.3-5
environment:
APP_NAME: user_saml
CORE_BRANCH: stable21
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php7.4
image: nextcloudci/php7.4:php7.4-2
environment:
APP_NAME: user_saml
CORE_BRANCH: stable21
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
- name: php8.0
image: nextcloudci/php8.0:latest
environment:
APP_NAME: user_saml
CORE_BRANCH: stable21
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/apps/$APP_NAME
- cd tests/unit/
- phpunit --configuration phpunit.xml
trigger:
branch:
- master
- stable*
event:
- pull_request
- push
type: docker
---

35
.github/workflows/lint-php-cs.yml vendored Normal file
View file

@ -0,0 +1,35 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
lint:
runs-on: ubuntu-latest
name: php-cs
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
coverage: none
- name: Install dependencies
run: composer i
- name: Lint
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )

35
.github/workflows/lint-php.yml vendored Normal file
View file

@ -0,0 +1,35 @@
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
name: Lint
on:
pull_request:
push:
branches:
- master
- stable*
jobs:
lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ["7.3", "7.4", "8.0"]
name: php
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: composer run lint

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

@ -0,0 +1,74 @@
name: PHPUnit
on:
pull_request:
push:
branches:
- master
- stable*
env:
APP_NAME: user_saml
jobs:
php:
runs-on: ubuntu-latest
strategy:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
databases: ['sqlite']
server-versions: ['stable21', 'stable22', 'stable23', '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 }}
run: |
cd tests/unit
../../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 }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)

2
.gitignore vendored
View file

@ -7,3 +7,5 @@
3rdparty/vendor/onelogin/php-saml/endpoints/
build
vendor
.php_cs.cache

17
.php_cs.dist Normal file
View file

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

19
composer.json Normal file
View file

@ -0,0 +1,19 @@
{
"name": "nextcloud/user_saml",
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"platform": {
"php": "7.4"
}
},
"scripts": {
"cs:fix": "php-cs-fixer fix",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"lint": "find . -name \\*.php -not -path '*/vendor/*' -print0 | xargs -0 -n1 php -l"
},
"require-dev": {
"nextcloud/coding-standard": "^0.5.0",
"phpunit/phpunit": "^8"
}
}

3939
composer.lock generated Normal file

File diff suppressed because it is too large Load diff