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@7d433286e92318f51ed0537b6c77374759e12f46 # v1.3.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 : ['stable27']
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 :
@@ -56,25 +79,20 @@ jobs:
56
79
# Split and keep last
57
80
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
58
81
59
- - name : Enable ONLY_FULL_GROUP_BY MySQL option
60
- run : |
61
- echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
62
- echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
63
-
64
82
- name : Checkout server
65
- uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
83
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
66
84
with :
67
85
submodules : true
68
86
repository : nextcloud/server
69
87
ref : ${{ matrix.server-versions }}
70
88
71
89
- name : Checkout app
72
- uses : actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
90
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
73
91
with :
74
92
path : apps/${{ env.APP_NAME }}
75
93
76
94
- name : Set up php ${{ matrix.php-versions }}
77
- uses : shivammathur/setup-php@c5fc0d8281aba02c7fda07d3a70cc5371548067d # v2
95
+ uses : shivammathur/setup-php@6d7209f44a25a59e904b1ee9f3b0c33ab2cd888d # v2
78
96
with :
79
97
php-version : ${{ matrix.php-versions }}
80
98
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
@@ -84,9 +102,14 @@ jobs:
84
102
env :
85
103
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
86
104
105
+ - name : Enable ONLY_FULL_GROUP_BY MySQL option
106
+ run : |
107
+ echo "SET GLOBAL sql_mode=(SELECT CONCAT(@@sql_mode,',ONLY_FULL_GROUP_BY'));" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
108
+ echo "SELECT @@sql_mode;" | mysql -h 127.0.0.1 -P 4444 -u root -prootpassword
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
@@ -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