22# SPDX-License-Identifier: MIT
33name : PHPUnit
44
5- on :
6- pull_request :
7- push :
8- branches :
9- - main
10- - stable*
5+ on : pull_request
6+
7+ permissions :
8+ contents : read
9+
10+ concurrency :
11+ group : phpunit-${{ github.head_ref || github.run_id }}
12+ cancel-in-progress : true
1113
1214env :
1315 APP_NAME : contacts
1416
1517jobs :
16- php :
18+ changes :
19+ runs-on : ubuntu-latest-low
20+ permissions :
21+ contents : read
22+ pull-requests : read
23+
24+ outputs :
25+ src : ${{ steps.changes.outputs.src}}
26+
27+ steps :
28+ - uses : dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
29+ id : changes
30+ continue-on-error : true
31+ with :
32+ filters : |
33+ src:
34+ - '.github/workflows/**'
35+ - 'appinfo/**'
36+ - 'lib/**'
37+ - 'templates/**'
38+ - 'tests/**'
39+ - 'vendor/**'
40+ - 'vendor-bin/**'
41+ - '.php-cs-fixer.dist.php'
42+ - 'composer.json'
43+ - 'composer.lock'
44+
45+ phpunit-sqlite :
1746 runs-on : ubuntu-latest
1847
48+ needs : [ changes ]
49+ if : needs.changes.outputs.src != 'false'
50+
1951 strategy :
2052 # do not stop on another job's failure
2153 fail-fast : false
2254 matrix :
2355 php-versions : ['8.2', '8.3', '8.4', '8.5']
2456 databases : ['sqlite']
25- server-versions : ['master', 'stable33', 'stable32']
26- exclude :
27- - php-versions : ' 8.5'
28- server-versions : ' stable32'
57+ server-versions : ['master']
2958 include :
3059 - php-versions : ' 8.1'
3160 databases : ' sqlite'
@@ -37,13 +66,15 @@ jobs:
3766 - name : Checkout server
3867 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
3968 with :
69+ persist-credentials : false
4070 repository : nextcloud/server
4171 ref : ${{ matrix.server-versions }}
4272 submodules : true
4373
4474 - name : Checkout app
4575 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
4676 with :
77+ persist-credentials : false
4778 path : apps/${{ env.APP_NAME }}
4879
4980 - name : Set up php ${{ matrix.php-versions }}
@@ -88,23 +119,19 @@ jobs:
88119 CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
89120 run : bash <(curl -s https://codecov.io/bash)
90121
91- mysql :
122+ phpunit-mariadb :
92123 runs-on : ubuntu-latest
93124
125+ needs : [ changes ]
126+ if : needs.changes.outputs.src != 'false'
127+
94128 strategy :
95129 # do not stop on another job's failure
96130 fail-fast : false
97131 matrix :
98- php-versions : ['8.2', '8.3', '8.4', '8.5 ']
132+ php-versions : ['8.4 ']
99133 databases : ['mysql']
100- server-versions : ['master', 'stable33','stable32']
101- exclude :
102- - php-versions : ' 8.5'
103- server-versions : ' stable32'
104- include :
105- - php-versions : ' 8.1'
106- databases : ' mysql'
107- server-versions : ' stable32'
134+ server-versions : ['master', 'stable33', 'stable32']
108135
109136 name : php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
110137
@@ -121,13 +148,15 @@ jobs:
121148 - name : Checkout server
122149 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
123150 with :
151+ persist-credentials : false
124152 repository : nextcloud/server
125153 ref : ${{ matrix.server-versions }}
126154 submodules : true
127155
128156 - name : Checkout app
129157 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
130158 with :
159+ persist-credentials : false
131160 path : apps/${{ env.APP_NAME }}
132161
133162 - name : Patch for nightly PHP
@@ -167,14 +196,17 @@ jobs:
167196 # working-directory: apps/${{ env.APP_NAME }}
168197 # run: composer run test:integration
169198
170- pgsql :
199+ phpunit- pgsql :
171200 runs-on : ubuntu-latest
172201
202+ needs : [ changes ]
203+ if : needs.changes.outputs.src != 'false'
204+
173205 strategy :
174206 # do not stop on another job's failure
175207 fail-fast : false
176208 matrix :
177- php-versions : ['8.2', '8.3', '8.4', '8. 5']
209+ php-versions : ['8.5']
178210 databases : ['pgsql']
179211 server-versions : ['master', 'stable33', 'stable32']
180212 exclude :
@@ -184,6 +216,7 @@ jobs:
184216 - php-versions : ' 8.1'
185217 databases : ' pgsql'
186218 server-versions : ' stable32'
219+
187220 name : php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}
188221
189222 services :
@@ -201,13 +234,15 @@ jobs:
201234 - name : Checkout server
202235 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
203236 with :
237+ persist-credentials : false
204238 repository : nextcloud/server
205239 ref : ${{ matrix.server-versions }}
206240 submodules : true
207241
208242 - name : Checkout app
209243 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
210244 with :
245+ persist-credentials : false
211246 path : apps/${{ env.APP_NAME }}
212247
213248 - name : Set up php ${{ matrix.php-versions }}
@@ -243,20 +278,22 @@ jobs:
243278
244279 summary :
245280
246- runs-on : ubuntu-latest
281+ runs-on : ubuntu-latest-low
282+
247283 needs :
248- - php
249- - mysql
250- - pgsql
284+ - changes
285+ - phpunit-sqlite
286+ - phpunit-mariadb
287+ - phpunit-pgsql
251288
252289 if : always()
253290
254291 name : php-test-summary
255292
256293 steps :
257294 - name : Sqlite test status
258- run : if ${{ needs.php.result != 'success ' && needs.php .result != 'skipped ' }}; then exit 1; fi
259- - name : Mysql test status
260- run : if ${{ needs.mysql.result != 'success ' && needs.mysql .result != 'skipped ' }}; then exit 1; fi
295+ run : if ${{ needs.changes.outputs.src != 'false ' && needs.phpunit-sqlite .result != 'success ' }}; then exit 1; fi
296+ - name : MariaDB test status
297+ run : if ${{ needs.changes.outputs.src != 'false ' && needs.phpunit-mariadb .result != 'success ' }}; then exit 1; fi
261298 - name : Pgsql test status
262- run : if ${{ needs.pgsql.result != 'success ' && needs.pgsql.result != 'skipped ' }}; then exit 1; fi
299+ run : if ${{ needs.changes.outputs.src != 'false ' && needs.phpunit- pgsql.result != 'success ' }}; then exit 1; fi
0 commit comments