ci: move to github actions

pull/126/head
sualko 2021-02-13 16:47:20 +01:00
parent b20eb7acf7
commit 92b85ba6ff
5 changed files with 115 additions and 87 deletions

33
.github/workflows/lint.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: Lint
on: pull_request
jobs:
xml-linters:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Download schema
run: wget https://apps.nextcloud.com/schema/apps/info.xsd
- name: Lint info.xml
uses: ChristophWurst/xmllint-action@v1
with:
xml-file: ./appinfo/info.xml
xml-schema-file: ./info.xsd
php-linters:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.2, 7.3, 7.4, 8.0]
name: php${{ matrix.php-versions }} lint
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
coverage: none
- name: Lint
run: composer run lint

57
.github/workflows/php-test.yml vendored Normal file
View File

@ -0,0 +1,57 @@
name: PHP Tests
on:
pull_request:
push:
branches:
- master
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.3', '7.4']
nextcloud-versions: ['stable19', 'stable20', 'stable21', 'master']
include:
- php-versions: '7.2'
nextcloud-versions: 'stable19'
- php-versions: '7.2'
nextcloud-versions: 'stable20'
- php-versions: '8.0'
nextcloud-versions: 'stable21'
- php-versions: '8.0'
nextcloud-versions: 'master'
name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} unit tests
env:
CI: true
XDEBUG_MODE: coverage
steps:
- name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: ctype, curl, dom, gd, gmp, iconv, intl, json, mbstring, openssl, pdo_sqlite, posix, sqlite, xml, zip
coverage: xdebug
- name: Checkout Nextcloud
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud
- name: Install Nextcloud
run: php -f nextcloud/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database sqlite --database-pass=''
- name: Checkout the app
uses: actions/checkout@master
with:
path: nextcloud/apps/bbb
- name: Fix php-parser on stable20 incompatibility with phpunit 9.3+
if: ${{ matrix.nextcloud-versions == 'stable20' }}
working-directory: nextcloud/3rdparty
run: composer require nikic/php-parser:4.10
- name: Downgrade phpunit for php7.2
if: ${{ matrix.php-versions == '7.2' }}
working-directory: nextcloud/apps/bbb
run: composer update christophwurst/nextcloud_testing -W
- name: Install dependencies
working-directory: nextcloud/apps/bbb
run: composer install
- name: Run tests
working-directory: nextcloud/apps/bbb
run: composer run test

24
.github/workflows/static.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Static analysis
on: [push]
jobs:
static-psalm-analysis:
runs-on: ubuntu-latest
strategy:
matrix:
ocp-version: [ 'dev-master', 'v20.0.0' ]
name: Nextcloud ${{ matrix.ocp-version }}
steps:
- name: Checkout
uses: actions/checkout@master
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: 7.4
coverage: none
- name: Install dependencies
run: composer i
- name: Install dependencies
run: composer require --dev christophwurst/nextcloud:${{ matrix.ocp-version }}
- name: Run coding standards check
run: composer run psalm

View File

@ -1,87 +0,0 @@
dist: bionic
language: php
php:
- 7.2
- 7.3
- 7.4
services:
- mysql
- postgresql
env:
global:
- CORE_BRANCH=stable20
- DB=mysql
- LINT=false
- BUILD=false
matrix:
include:
- php: 7.3
env: DB=sqlite
- php: 7.4
env: DB=sqlite
- php: 7.3
env: DB=pgsql
- php: 7.4
env: DB=pgsql
- php: 7.3
env: LINT=true
env: BUILD=true
- php: 7.2
env: DB=sqlite CORE_BRANCH=stable19
- php: 7.3
env: CORE_BRANCH=stable18
- php: 7.4
env: CORE_BRANCH=master
- php: nightly
env: DB=sqlite
fast_finish: true
allow_failures:
- php: nightly
- php: 7.4
env: "CORE_BRANCH=master"
cache:
yarn: true
directories:
- "$HOME/core/apps/bbb/node_modules"
- "$HOME/.composer/cache/files"
- "$HOME/.npm"
#before_script: phpenv global 7.3
before_install:
- php --info
# Set up DB
- if [[ "$DB" == 'pgsql' ]]; then createuser -U travis -s oc_autotest; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e 'create database oc_autotest;'; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"; fi
- if [[ "$DB" == 'mysql' ]]; then mysql -u root -e "GRANT ALL ON oc_autotest.* TO 'oc_autotest'@'localhost';"; fi
- composer self-update
- yarn install
- yarn composer:install:dev
- cd ..
- git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_BRANCH core
- mv cloud_bbb core/apps/bbb
before_script:
# Set up core
- php -f core/occ maintenance:install --database-name oc_autotest --database-user oc_autotest --admin-user admin --admin-pass admin --database $DB --database-pass=''
# Set up app
- php -f core/occ app:enable bbb
# Enable app twice to check occ errors of registered commands
- php -f core/occ app:enable bbb
- cd core/apps/bbb
script:
- php -v
- yarn test
- if [[ "$LINT" = 'true' ]]; then yarn lint; fi
- if [[ "$LINT" = 'true' ]]; then yarn commitlint-travis; fi
- if [[ "$BUILD" = 'true' ]]; then yarn build; fi

View File

@ -25,6 +25,7 @@
"classmap-authoritative": true
},
"scripts": {
"test": "phpunit --configuration phpunit.xml --fail-on-warning",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"lint": "find . -name \\*.php -not -path './vendor/*' -exec php -l \"{}\" \\;",