3
3
# https://github.com/nextcloud/.github
4
4
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
5
5
6
- name : PHPUnit mysql
7
-
8
- on :
9
- pull_request :
10
- paths :
11
- - ' .github/workflows/**'
12
- - ' appinfo/**'
13
- - ' lib/**'
14
- - ' templates/**'
15
- - ' tests/**'
16
- - ' vendor/**'
17
- - ' vendor-bin/**'
18
- - ' .php-cs-fixer.dist.php'
19
- - ' composer.json'
20
- - ' composer.lock'
21
-
22
- push :
23
- branches :
24
- - main
25
- - master
26
- - stable*
6
+ name : PHPUnit MySQL
7
+
8
+ on : pull_request
27
9
28
10
permissions :
29
11
contents : read
@@ -33,17 +15,58 @@ concurrency:
33
15
cancel-in-progress : true
34
16
35
17
jobs :
18
+ matrix :
19
+ runs-on : ubuntu-latest-low
20
+ outputs :
21
+ matrix : ${{ steps.versions.outputs.sparse-matrix }}
22
+ steps :
23
+ - name : Checkout app
24
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
25
+
26
+ - name : Get version matrix
27
+ id : versions
28
+ uses : icewind1991/nextcloud-version-matrix@d594a6929da316b732c53355e52a1ead77ba36c7 # v1.2.0
29
+ with :
30
+ matrix : ' {"mysql-versions": ["8.1"]}'
31
+
32
+ changes :
33
+ runs-on : ubuntu-latest-low
34
+
35
+ outputs :
36
+ src : ${{ steps.changes.outputs.src}}
37
+
38
+ steps :
39
+ - uses : dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
40
+ id : changes
41
+ continue-on-error : true
42
+ with :
43
+ filters : |
44
+ src:
45
+ - '.github/workflows/**'
46
+ - 'appinfo/**'
47
+ - 'lib/**'
48
+ - 'templates/**'
49
+ - 'tests/**'
50
+ - 'vendor/**'
51
+ - 'vendor-bin/**'
52
+ - '.php-cs-fixer.dist.php'
53
+ - 'composer.json'
54
+ - 'composer.lock'
55
+
36
56
phpunit-mysql :
37
57
runs-on : ubuntu-latest
38
58
59
+ needs : [changes, matrix]
60
+ if : needs.changes.outputs.src != 'false'
61
+
39
62
strategy :
40
- matrix :
41
- php-versions : ['8.0', '8.1', '8.2']
42
- server-versions : ['master']
63
+ matrix : ${{ fromJson(needs.matrix.outputs.matrix) }}
64
+
65
+ name : MySQL ${{ matrix.mysql-versions }} PHP ${{ matrix.php-versions }} Nextcloud ${{ matrix. server-versions }}
43
66
44
67
services :
45
68
mysql :
46
- image : ghcr.io/nextcloud/continuous-integration-mariadb-10.6 :latest
69
+ image : ghcr.io/nextcloud/continuous-integration-mysql-${{ matrix.mysql-versions }} :latest
47
70
ports :
48
71
- 4444:3306/tcp
49
72
env :
@@ -57,19 +80,19 @@ jobs:
57
80
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
58
81
59
82
- name : Checkout server
60
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
83
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
61
84
with :
62
85
submodules : true
63
86
repository : nextcloud/server
64
87
ref : ${{ matrix.server-versions }}
65
88
66
89
- name : Checkout app
67
- uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
90
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
68
91
with :
69
92
path : apps/${{ env.APP_NAME }}
70
93
71
94
- name : Set up php ${{ matrix.php-versions }}
72
- uses : shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
95
+ uses : shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
73
96
with :
74
97
php-version : ${{ matrix.php-versions }}
75
98
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -86,15 +109,15 @@ jobs:
86
109
87
110
- name : Check composer file existence
88
111
id : check_composer
89
- uses : andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
112
+ uses : andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v2
90
113
with :
91
114
files : apps/${{ env.APP_NAME }}/composer.json
92
115
93
116
- name : Set up dependencies
94
117
# Only run if phpunit config file exists
95
118
if : steps.check_composer.outputs.files_exists == 'true'
96
119
working-directory : apps/${{ env.APP_NAME }}
97
- run : composer install
120
+ run : composer i
98
121
99
122
- name : Set up Nextcloud
100
123
env :
@@ -150,13 +173,13 @@ jobs:
150
173
summary :
151
174
permissions :
152
175
contents : none
153
- runs-on : ubuntu-latest
154
- needs : phpunit-mysql
176
+ runs-on : ubuntu-latest-low
177
+ needs : [changes, phpunit-mysql]
155
178
156
179
if : always()
157
180
158
181
name : phpunit-mysql-summary
159
182
160
183
steps :
161
184
- name : Summary status
162
- run : if ${{ needs.phpunit-mysql.result != 'success' }}; then exit 1; fi
185
+ run : if ${{ needs.changes.outputs.src != 'false' && needs. phpunit-mysql.result != 'success' }}; then exit 1; fi
0 commit comments