-
Notifications
You must be signed in to change notification settings - Fork 319
148 lines (134 loc) Β· 5.26 KB
/
Copy pathphp-test.yml
File metadata and controls
148 lines (134 loc) Β· 5.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# SPDX-FileCopyrightText: 2020-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: PHP Tests
on: pull_request
jobs:
changes:
runs-on: ubuntu-latest-low
permissions:
contents: read
pull-requests: read
outputs:
src: ${{ steps.changes.outputs.src}}
steps:
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: changes
continue-on-error: true
with:
filters: |
src:
- '.github/workflows/**'
- 'lib/**'
- 'appinfo/**'
- 'composer/**'
- 'templates/**'
- 'tests/php/**'
- 'composer.json'
- 'composer.lock'
- 'phpunit.integration.xml'
- 'phpunit.unit.xml'
- '**.php'
unit-tests:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
strategy:
matrix:
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
nextcloud-versions: [ 'master' ]
include:
- php-versions: '8.1'
nextcloud-versions: 'stable32'
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@5efa2a774eb6c55954af5652a1f947afbc8dd282
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.4' }}
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
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:unit
- name: Upload coverage to Codecov
if: ${{ matrix.nextcloud-versions == 'master' }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: nextcloud/apps/calendar/clover.unit.xml
flags: php
fail_ci_if_error: ${{ !github.event.pull_request.head.repo.fork }}
verbose: true
integration-tests:
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.src != 'false'
strategy:
matrix:
php-versions: [ '8.2', '8.3', '8.4', '8.5' ]
nextcloud-versions: [ 'master', 'stable32' ]
exclude:
- php-versions: '8.5'
nextcloud-versions: 'stable32'
include:
- php-versions: '8.1'
nextcloud-versions: 'stable32'
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@5efa2a774eb6c55954af5652a1f947afbc8dd282
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.4' }}
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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
with:
path: nextcloud/apps/calendar
- name: Install dependencies
working-directory: nextcloud/apps/calendar
run: composer install
- name: Install Calendar
run: php -f nextcloud/occ app:enable calendar
- 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()
name: php-test-summary
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