Skip to content

Commit ee932da

Browse files
authored
Merge pull request #725 from nextcloud/workflow-unit-tests
phpUnit tests workflow
2 parents 8102609 + 3721192 commit ee932da

11 files changed

Lines changed: 913 additions & 378 deletions

File tree

β€Ž.github/workflows/node.ymlβ€Ž

Lines changed: 0 additions & 53 deletions
This file was deleted.

β€Ž.github/workflows/test.ymlβ€Ž

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- stable*
9+
10+
jobs:
11+
unit-tests:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
php-versions: [7.3, 7.4]
16+
nextcloud-versions: ['stable21', 'stable22', 'stable23']
17+
include:
18+
- php-versions: 7.4
19+
nextcloud-versions: stable24
20+
- php-versions: 8.0
21+
nextcloud-versions: stable24
22+
- php-versions: 7.4
23+
nextcloud-versions: master
24+
- php-versions: 8.0
25+
nextcloud-versions: master
26+
name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests
27+
steps:
28+
- name: Set up php${{ matrix.php-versions }}
29+
uses: shivammathur/setup-php@master
30+
with:
31+
php-version: ${{ matrix.php-versions }}
32+
tools: composer:v1
33+
extensions: ctype,curl,dom,gd,iconv,intl,json,mbstring,openssl,posix,sqlite,xml,zip,gmp
34+
coverage: xdebug
35+
- name: Checkout Nextcloud
36+
run: git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b ${{ matrix.nextcloud-versions }} nextcloud
37+
- name: Install Nextcloud
38+
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=''
39+
- name: Checkout Viewer
40+
run: git clone https://github.com/nextcloud/viewer.git -b ${{ matrix.nextcloud-versions }} viewer
41+
working-directory: nextcloud/apps
42+
- name: Enable Viewer
43+
run: php -f nextcloud/occ app:enable viewer
44+
- name: Fix php-parser on stable20 incompatibility with phpunit 9.3+
45+
if: ${{ matrix.nextcloud-versions == 'stable20' }}
46+
working-directory: nextcloud/3rdparty
47+
run: composer require nikic/php-parser:4.10
48+
- name: Checkout Maps
49+
uses: actions/checkout@v3
50+
with:
51+
path: nextcloud/apps/maps
52+
- name: Install dependencies
53+
working-directory: nextcloud/apps/maps
54+
run: composer install
55+
- name: Enable maps app
56+
working-directory: nextcloud
57+
run: php -f occ app:enable maps
58+
- name: Run tests
59+
working-directory: nextcloud/apps/maps
60+
run: composer run test:unit
61+
env:
62+
XDEBUG_MODE: coverage
63+
- name: Report coverage
64+
uses: codecov/codecov-action@v3.0.0
65+
if: ${{ always() && matrix.nextcloud-versions == 'master' }}
66+
with:
67+
file: ./nextcloud/apps/maps/tests/clover.unit.xml
68+
flags: unittests
69+
fail_ci_if_error: true
70+
71+
frontend-unit-test:
72+
runs-on: ubuntu-latest
73+
name: Front-end unit tests
74+
steps:
75+
- uses: actions/checkout@v3
76+
- name: Set up Node
77+
uses: actions/setup-node@v3
78+
with:
79+
node-version: 12.x
80+
- name: npm ci
81+
run: npm ci
82+
env:
83+
CI: true

β€Žappinfo/info.xmlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<screenshot>https://raw.githubusercontent.com/nextcloud/maps/master/screenshots/screenshot3.png</screenshot>
3434
<dependencies>
3535
<lib>exif</lib>
36-
<nextcloud min-version="20" max-version="24"/>
36+
<nextcloud min-version="20" max-version="25"/>
3737
<php min-version="7.3" max-version="8.0"/>
3838
</dependencies>
3939
<repair-steps>

β€Žcomposer.jsonβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"bogdaan/open-location-code": "dev-master"
55
},
66
"require-dev": {
7-
"christophwurst/nextcloud_testing": "^0.9.1"
8-
}
7+
"christophwurst/nextcloud_testing": "^0.12.4"
8+
},
9+
"scripts": {
10+
"test:integration": "phpunit -c tests/phpunit.integration.xml --fail-on-warning",
11+
"test:integration:dev": "phpunit -c tests/phpunit.integration.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure",
12+
"test:unit": "phpunit -c tests/phpunit.unit.xml --fail-on-warning",
13+
"test:unit:dev": "phpunit -c tests/phpunit.unit.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure"
14+
}
915
}

0 commit comments

Comments
Β (0)