calendar/.github/workflows/php-test.yml

60 lines
2.1 KiB
YAML

name: PHP Tests
on:
pull_request:
push:
branches:
- main
jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['7.4']
nextcloud-versions: ['stable22', 'stable23']
include:
- php-versions: '7.4'
nextcloud-versions: 'stable24'
- php-versions: '8.0'
nextcloud-versions: 'stable24'
- php-versions: '8.1'
nextcloud-versions: 'stable24'
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@v2
with:
path: nextcloud/apps/calendar
- 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: Install dependencies
working-directory: nextcloud/apps/calendar
run: composer install
- name: Run tests
working-directory: nextcloud/apps/calendar
run: composer run test
- name: Upload coverage to Codecov
if: ${{ matrix.nextcloud-versions == 'master' }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: nextcloud/apps/calendar/clover.unit.xml
flags: php
fail_ci_if_error: true