Skip to content

Commit

Permalink
chore: add integration tests to CI
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Larch <[email protected]>
  • Loading branch information
miaulalala committed Jun 26, 2023
1 parent 19f691f commit 0aa64a2
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,53 @@ jobs:
fail_ci_if_error: true
verbose: true

integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ '8.0', '8.1', '8.2' ]
nextcloud-versions: [ 'master']
include:
- php-versions: '7.4'
nextcloud-versions: 'stable25'
- php-versions: '8.1'
nextcloud-versions: 'stable26'
- php-versions: '8.1'
nextcloud-versions: 'stable27'
name: php${{ matrix.php-versions }} on ${{ matrix.nextcloud-versions }} integration tests
env:
CI: true
XDEBUG_MODE: coverage
steps:
- name: Set up php${{ matrix.php-versions }}
uses: shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d
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: Patch version check for nightly PHP
if: ${{ matrix.php-versions == '8.2' }}
run: echo "<?php" > nextcloud/lib/versioncheck.php
- 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@v3
with:
path: nextcloud/apps/calendar
- name: Install dependencies
working-directory: nextcloud/apps/calendar
run: composer install
- name: Run tests
working-directory: nextcloud/apps/calendar
run: composer run test:integration

summary:
runs-on: ubuntu-latest
needs:
- unit-tests
- integration-tests

if: always()

Expand All @@ -62,3 +105,6 @@ jobs:
steps:
- name: Unit test status
run: if ${{ needs.unit-tests.result != 'success' && needs.unit-tests.result != 'skipped' }}; then exit 1; fi
- name: Integration test status
run: if ${{ needs.integration-tests.result != 'success' && needs.integration-tests.result != 'skipped' }}; then exit 1; fi

2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './tests/*' -print0 | xargs -0 -n1 php -l",
"test": "phpunit --configuration phpunit.unit.xml --fail-on-warning",
"test:dev": "phpunit --configuration phpunit.unit.xml --fail-on-warning --stop-on-error --stop-on-failure",
"test:integration": "phpunit -c phpunit.integration.xml --fail-on-warning",
"test:integration:dev": "phpunit -c phpunit.integration.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure",
"post-install-cmd": [
"@composer bin all install --ansi"
],
Expand Down
37 changes: 37 additions & 0 deletions phpunit.integration.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ @copyright 2019 Christoph Wurst <[email protected]>
~
~ @author 2019 Christoph Wurst <[email protected]>
~
~ @license GNU AGPL version 3 or any later version
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU Affero General Public License as
~ published by the Free Software Foundation, either version 3 of the
~ License, or (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU Affero General Public License for more details.
~
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/php/unit/bootstrap.php"
verbose="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">../lib</directory>
</include>
<report>
<clover outputFile="./clover.integration.xml"/>
</report>
</coverage>
<testsuite name="integration">
<directory suffix="Test.php">./tests/php/integration</directory>
</testsuite>
</phpunit>

0 comments on commit 0aa64a2

Please sign in to comment.