8
8
9
9
jobs :
10
10
tests :
11
- name : PHP ${{ matrix.php }}, SF ${{ matrix.symfony }} - ${{ matrix.deps }} ${{ matrix.use-orm == '1 ' && (matrix.orm-db == 'postgres' && '- ORM (postgres )' || '- ORM (mysql)') || '' }} ${{ matrix.use-odm == '1' && '- ODM' || '' }} ${{ matrix.use-dama == '1' && '- DAMA ' || '' }}
11
+ name : P: ${{ matrix.php }}, S: ${{ matrix.symfony }}, D: ${{ matrix.database }}${{ matrix.deps == 'lowest ' && ' (lowest )' || '' }} ${{ matrix.use-dama == 1 && contains( matrix.database, 'sql') && ' (dama) ' || '' }}
12
12
runs-on : ubuntu-latest
13
13
strategy :
14
- fail-fast : false
15
14
matrix :
16
- php : [8.0, 8.1, 8.2]
17
- symfony : [5.4.*, 6.2.*, 6.3.*]
18
- deps : [highest]
19
- use-orm : [1]
20
- use-odm : [1]
21
- use-dama : [1]
22
- orm-db : [postgres]
23
- exclude :
24
- - {use-orm: 0, use-odm: 0} # tested directly in a test case
25
- - {use-orm: 0, use-dama: 1} # cannot happen
26
- # conflicts
27
- - {php: 8.0, symfony: 6.2.*}
28
- - {php: 8.0, symfony: 6.3.*}
15
+ php : [ 8.1, 8.2 ]
16
+ deps : [ highest ]
17
+ symfony : [ 6.3.*, 6.4.* ]
18
+ database : [ mysql, mongo ]
19
+ use-dama : [ 1 ]
29
20
include :
30
- - {php: 8.0, symfony: 5.4.*, use-orm: 1, use-odm: 0, use-dama: 0, deps: lowest, orm-db: postgres}
31
- - {php: 8.0, symfony: 5.4.*, use-orm: 1, use-odm: 1, use-dama: 0, deps: lowest, orm-db: postgres}
32
- - {php: 8.0, symfony: 5.4.*, use-orm: 0, use-odm: 1, use-dama: 0, deps: lowest, orm-db: postgres}
33
- - {php: 8.2, symfony: 6.3.*, use-orm: 1, use-odm: 0, use-dama: 0, deps: highest, orm-db: postgres}
34
- - {php: 8.2, symfony: 6.3.*, use-orm: 1, use-odm: 1, use-dama: 0, deps: highest, orm-db: postgres}
35
- - {php: 8.2, symfony: 6.3.*, use-orm: 1, use-odm: 0, use-dama: 1, deps: highest, orm-db: postgres}
36
- - {php: 8.2, symfony: 6.3.*, use-orm: 0, use-odm: 1, use-dama: 0, deps: highest, orm-db: postgres}
37
- - {php: 8.2, symfony: 6.3.*, use-orm: 1, use-odm: 0, use-dama: 1, deps: highest, orm-db: mysql}
38
- - {php: 8.2, symfony: 6.3.*, use-orm: 1, use-odm: 0, use-dama: 0, deps: highest, orm-db: mysql}
39
-
21
+ - php : 8.0
22
+ deps : lowest
23
+ symfony : ' 5.4.*'
24
+ database : mysql|mongo
25
+ use-dama : 1
26
+ - php : 8.2
27
+ deps : highest
28
+ symfony : ' *'
29
+ database : none
30
+ use-dama : 1
31
+ - php : 8.2
32
+ deps : highest
33
+ symfony : ' *'
34
+ database : mysql|mongo
35
+ use-dama : 1
36
+ - php : 8.2
37
+ deps : highest
38
+ symfony : ' *'
39
+ database : pgsql|mongo
40
+ use-dama : 1
41
+ - php : 8.2
42
+ deps : highest
43
+ symfony : ' *'
44
+ database : mysql
45
+ use-dama : 0
46
+ - php : 8.2
47
+ deps : highest
48
+ symfony : ' *'
49
+ database : pgsql
50
+ use-dama : 0
51
+ env :
52
+ DATABASE_URL : ${{ contains(matrix.database, 'mysql') && 'mysql://root:root@localhost:3306/foundry?serverVersion=5.7.42' || contains(matrix.database, 'pgsql') && 'postgresql://root:root@localhost:5432/foundry?serverVersion=15' || '' }}
53
+ MONGO_URL : ${{ contains(matrix.database, 'mongo') && 'mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb' || '' }}
54
+ USE_DAMA_DOCTRINE_TEST_BUNDLE : ${{ matrix.use-dama == 1 && contains(matrix.database, 'sql') && 1 || 0 }}
40
55
services :
41
- mysql :
42
- image : mysql:5.7.42
43
- env :
44
- MYSQL_ROOT_PASSWORD : 1234
45
- ports :
46
- - 3306:3306
47
- options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
48
-
49
56
postgres :
50
- image : postgres:15
57
+ image : ${{ contains(matrix.database, 'pgsql') && ' postgres:15' || '' }}
51
58
env :
52
- POSTGRES_USER : postgres
53
- POSTGRES_DB : zenstruck_foundry_${{ matrix.use-dama }}_${{ matrix.orm-db }}
54
- POSTGRES_PASSWORD : 1234
55
- options : --health-cmd pg_isready --health-interval=10s --health-timeout=5s --health-retries=5
59
+ POSTGRES_USER : root
60
+ POSTGRES_PASSWORD : root
61
+ POSTGRES_DB : foundry
56
62
ports :
57
63
- 5432:5432
58
-
64
+ options : >-
65
+ --health-cmd pg_isready
66
+ --health-interval 10s
67
+ --health-timeout 5s
68
+ --health-retries 5
59
69
mongo :
60
- image : mongo:4
70
+ image : ${{ contains(matrix.database, ' mongo') && 'mongo:4' || '' }}
61
71
ports :
62
72
- 27017:27017
63
-
64
- env :
65
- MYSQL_URL :
mysql://root:[email protected] :3306/zenstruck_foundry?serverVersion=5.7.42
66
- PGSQL_URL :
postgresql://postgres:[email protected] :5432/zenstruck_foundry_${{ matrix.use-dama }}_${{ matrix.orm-db }}?charset=utf8&serverVersion=15
67
- MONGO_URL : mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb
68
-
69
73
steps :
70
74
- name : Checkout code
71
75
uses : actions/checkout@v3
72
76
73
- - name : Verify MySQL version
74
- run : mysql --host 127.0.0.1 -uroot -p1234 -e "STATUS"
75
-
76
77
- name : Setup PHP
77
78
uses : shivammathur/setup-php@v2
78
79
with :
79
80
php-version : ${{ matrix.php }}
80
- extensions : pgsql, sqlite, mongodb
81
81
coverage : none
82
82
tools : flex
83
83
@@ -89,71 +89,68 @@ jobs:
89
89
env :
90
90
SYMFONY_REQUIRE : ${{ matrix.symfony }}
91
91
92
- - name : ' Test'
93
- run : |
94
- if [ "${{ matrix.use-dama }}" == "1" ]; then
95
- CONFIGURATION="--configuration phpunit-dama-doctrine.xml.dist"
96
- fi
92
+ - name : Set up MySQL
93
+ if : contains(matrix.database, 'mysql')
94
+ run : sudo /etc/init.d/mysql start
97
95
98
- vendor/bin/simple-phpunit ${CONFIGURATION}
96
+ - name : Test
97
+ run : vendor/bin/phpunit -c "${PHPUNIT_CONFIG_FILE}"
98
+ shell : bash
99
99
env :
100
- USE_ORM : ${{ matrix.use-orm }}
101
- USE_ODM : ${{ matrix.use-odm }}
102
- USE_FOUNDRY_BUNDLE : 1
103
- DATABASE_URL : ${{ matrix.orm-db == 'postgres' && env.PGSQL_URL || env.MYSQL_URL }}
100
+ TEST_MIGRATIONS : 1
101
+ PHPUNIT_CONFIG_FILE : ${{ env.USE_DAMA_DOCTRINE_TEST_BUNDLE == 1 && 'phpunit.dama.xml.dist' || 'phpunit.xml.dist' }}
104
102
105
103
code-coverage :
106
104
name : Code Coverage
107
105
runs-on : ubuntu-latest
106
+ env :
107
+ DATABASE_URL : postgresql://root:root@localhost:5432/foundry?serverVersion=15
108
+ MONGO_URL : mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb
108
109
services :
109
- mysql :
110
- image : mysql:5.7
111
- env :
112
- MYSQL_ROOT_PASSWORD : 1234
113
- ports :
114
- - 3306:3306
115
- options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
116
110
mongo :
117
111
image : mongo:4
118
112
ports :
119
113
- 27017:27017
120
-
121
- env :
122
- DATABASE_URL :
mysql://root:[email protected] :3306/zenstruck_foundry?serverVersion=5.7
123
- MONGO_URL : mongodb://127.0.0.1:27017/dbName?compressors=disabled&gssapiServiceName=mongodb
124
-
114
+ postgres :
115
+ image : postgres:15
116
+ env :
117
+ POSTGRES_USER : root
118
+ POSTGRES_PASSWORD : root
119
+ POSTGRES_DB : foundry
120
+ ports :
121
+ - 5432:5432
122
+ options : >-
123
+ --health-cmd pg_isready
124
+ --health-interval 10s
125
+ --health-timeout 5s
126
+ --health-retries 5
125
127
steps :
126
128
- name : Checkout code
127
129
uses : actions/checkout@v3
128
130
129
- - name : Verify MySQL version
130
- run : mysql --host 127.0.0.1 -uroot -p1234 -e "STATUS"
131
-
132
131
- name : Setup PHP
133
132
uses : shivammathur/setup-php@v2
134
133
with :
135
- php-version : 8.0
136
- extensions : pgsql, sqlite
134
+ php-version : 8.2
137
135
coverage : xdebug
138
136
ini-values : xdebug.mode=coverage
139
137
140
138
- name : Install dependencies
141
139
uses : ramsey/composer-install@v2
142
140
with :
143
141
composer-options : --prefer-dist
144
- dependency-versions : " highest"
145
142
146
- - name : ' Coverage'
147
- run : vendor/bin/simple-phpunit -v --configuration phpunit-dama-doctrine.xml.dist --coverage-text --coverage-clover=foundry.clover
143
+ - name : Test with coverage
144
+ run : vendor/bin/phpunit -c phpunit.dama.xml.dist --coverage-text --coverage-clover coverage.xml
145
+ shell : bash
148
146
env :
149
- USE_ORM : 1
150
- USE_ODM : 1
151
- USE_FOUNDRY_BUNDLE : 1
147
+ USE_FOUNDRY_BUNDLE : 0
148
+ SYMFONY_DEPRECATIONS_HELPER : disabled
152
149
153
150
- name : Publish coverage report to Codecov
154
151
uses : codecov/codecov-action@v3
155
152
with :
156
- file : ./*.clover
153
+ file : ./coverage.xml
157
154
158
155
composer-validate :
159
156
uses : zenstruck/.github/.github/workflows/php-composer-validate.yml@main
@@ -189,7 +186,7 @@ jobs:
189
186
- name : Setup PHP
190
187
uses : shivammathur/setup-php@v2
191
188
with :
192
- php-version : 8.0
189
+ php-version : 8.1
193
190
coverage : none
194
191
195
192
- name : Install dependencies
@@ -209,47 +206,6 @@ jobs:
209
206
- name : Run Psalm on factories generated with maker
210
207
run : bin/tools/psalm/vendor/vimeo/psalm/psalm
211
208
212
- test-docker-stack :
213
- name : CI with docker stack
214
- runs-on : ubuntu-latest
215
- strategy :
216
- fail-fast : false
217
- matrix :
218
- php : ['8.0', '8.1', '8.2']
219
- steps :
220
- - name : Checkout code
221
- uses : actions/checkout@v3
222
-
223
- - name : Run test suite with docker
224
- run : |
225
- echo "PHP_VERSION=${{ matrix.php }}" > .env
226
- make validate
227
-
228
- push_docker_images :
229
- name : Push docker images after CI complete on main branch
230
- needs : [tests, composer-validate, build-docs, static-analysis, test-docker-stack]
231
- runs-on : ubuntu-latest
232
- if : ${{ github.event_name == 'push' && github.event.ref == 'refs/heads/1.x' }}
233
- strategy :
234
- fail-fast : false
235
- matrix :
236
- php : ['8.0', '8.1', '8.2']
237
- steps :
238
- - name : Checkout code
239
- uses : actions/checkout@v3
240
-
241
- - name : Login to ghcr.io
242
- uses : docker/login-action@v2
243
- with :
244
- registry : ghcr.io/zenstruck
245
- username : token
246
- password : ${{ secrets.PACKAGE_PUSH_TOKEN }}
247
-
248
- - name : Build and push images
249
- run : ./docker/build.sh push ${{ matrix.php }}
250
- env :
251
- GITHUB_TOKEN : ${{ secrets.PACKAGE_PUSH_TOKEN }}
252
-
253
209
fixcs :
254
210
name : Run php-cs-fixer
255
211
needs : sync-with-template
@@ -271,4 +227,3 @@ jobs:
271
227
with :
272
228
key : ${{ secrets.GPG_PRIVATE_KEY }}
273
229
token : ${{ secrets.COMPOSER_TOKEN }}
274
- phpcsconfig : false
0 commit comments