Skip to content

Commit 52b82c3

Browse files
chore: update testing workflow
Signed-off-by: SebastianKrupinski <[email protected]>
1 parent 7ffc168 commit 52b82c3

File tree

4 files changed

+100
-257
lines changed

4 files changed

+100
-257
lines changed

.github/workflows/phpunit.yml

-235
This file was deleted.

.github/workflows/test.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: MIT
3+
name: Test
4+
on: pull_request
5+
6+
permissions:
7+
contents: read
8+
9+
env:
10+
APP_NAME: contacts
11+
12+
jobs:
13+
backend-unit-tests:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
php-versions: ['8.1', '8.2', '8.3']
18+
nextcloud-versions: ['master', 'stable30']
19+
include:
20+
- php-versions: '8.4'
21+
nextcloud-versions: 'master'
22+
name: php${{ matrix.php-versions }} branch ${{ matrix.nextcloud-versions }} unit tests
23+
24+
steps:
25+
- name: Set up Nextcloud env
26+
uses: ChristophWurst/setup-nextcloud@fc0790385c175d97e88a7cb0933490de6e990374 # v0.3.2
27+
with:
28+
nextcloud-version: ${{ matrix.nextcloud-versions }}
29+
php-version: ${{ matrix.php-versions }}
30+
php-coverage: 'xdebug'
31+
patch-php-version-check: ${{ matrix.php-versions == '8.4' }}
32+
node-version: 'false'
33+
install: true
34+
35+
- name: Checkout App
36+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
37+
with:
38+
path: nextcloud/apps/${{ env.APP_NAME }}
39+
40+
- name: Install dependencies
41+
working-directory: nextcloud/apps/${{ env.APP_NAME }}
42+
run: composer install
43+
44+
- name: Run tests
45+
working-directory: nextcloud/apps/${{ env.APP_NAME }}
46+
run: composer run test:unit
47+
if: ${{ matrix.php-versions == '8.3' }}
48+
env:
49+
XDEBUG_MODE: coverage
50+
51+
- name: Run tests
52+
working-directory: nextcloud/apps/${{ env.APP_NAME }}
53+
run: composer run test:unit
54+
if: ${{ matrix.php-versions != '8.3' }}
55+
env:
56+
XDEBUG_MODE: off
57+
58+
- name: Upload coverage to Codecov
59+
if: ${{ matrix.php-versions != '8.3' }}
60+
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4
61+
with:
62+
token: ${{ secrets.CODECOV_TOKEN }}
63+
file: nextcloud/apps/${{ env.APP_NAME }}/clover.unit.xml
64+
flags: php
65+
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
66+
verbose: true
67+
68+
summary:
69+
runs-on: ubuntu-latest
70+
needs:
71+
- backend-unit-tests
72+
73+
if: always()
74+
75+
name: php-test-summary
76+
77+
steps:
78+
- name: Unit test status
79+
run: if ${{ needs.backend-unit-tests.result != 'success' && needs.backend-unit-tests.result != 'skipped' }}; then exit 1; fi

codecov.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
comment: false
4+
ignore:
5+
- "tests"
6+
- "lib/Vendor"

phpunit.xml

+15-22
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,21 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<!--
3-
- SPDX-FileCopyrightText: 2019-2024 Nextcloud GmbH and Nextcloud contributors
4-
- SPDX-FileCopyrightText: 2015-2016 ownCloud, Inc.
3+
- SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
54
- SPDX-License-Identifier: AGPL-3.0-or-later
65
-->
7-
<phpunit bootstrap="tests/bootstrap.php"
6+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7+
bootstrap="tests/bootstrap.php"
88
verbose="true"
9-
convertDeprecationsToExceptions="true"
10-
colors="true"
11-
timeoutForSmallTests="900"
12-
timeoutForMediumTests="900"
13-
timeoutForLargeTests="900">
14-
<testsuite name='Contacts app tests'>
15-
<directory>./tests/unit</directory>
9+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.5/phpunit.xsd">
10+
<testsuite name="unit">
11+
<directory suffix="Test.php">./tests/unit</directory>
1612
</testsuite>
17-
<!-- filters for code coverage -->
18-
<filter>
19-
<whitelist>
20-
<directory suffix=".php">./</directory>
21-
<exclude>
22-
<directory suffix=".php">./l10n</directory>
23-
<directory suffix=".php">./templates</directory>
24-
<directory suffix=".php">./tests</directory>
25-
</exclude>
26-
</whitelist>
27-
</filter>
13+
<coverage>
14+
<include>
15+
<directory suffix=".php">./lib</directory>
16+
</include>
17+
<report>
18+
<clover outputFile="./clover.unit.xml"/>
19+
</report>
20+
</coverage>
2821
</phpunit>

0 commit comments

Comments
 (0)