88
99jobs :
1010 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) ' || '' }}
1212 runs-on : ubuntu-latest
1313 strategy :
14- fail-fast : false
1514 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 ]
2920 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 }}
4055 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-
4956 postgres :
50- image : postgres:15
57+ image : ${{ contains(matrix.database, 'pgsql') && ' postgres:15' || '' }}
5158 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
5662 ports :
5763 - 5432:5432
58-
64+ options : >-
65+ --health-cmd pg_isready
66+ --health-interval 10s
67+ --health-timeout 5s
68+ --health-retries 5
5969 mongo :
60- image : mongo:4
70+ image : ${{ contains(matrix.database, ' mongo') && 'mongo:4' || '' }}
6171 ports :
6272 - 27017:27017
63-
64- env :
65- MYSQL_URL : mysql://root:1234@127.0.0.1:3306/zenstruck_foundry?serverVersion=5.7.42
66- PGSQL_URL : postgresql://postgres:1234@127.0.0.1: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-
6973 steps :
7074 - name : Checkout code
7175 uses : actions/checkout@v3
7276
73- - name : Verify MySQL version
74- run : mysql --host 127.0.0.1 -uroot -p1234 -e "STATUS"
75-
7677 - name : Setup PHP
7778 uses : shivammathur/setup-php@v2
7879 with :
7980 php-version : ${{ matrix.php }}
80- extensions : pgsql, sqlite, mongodb
8181 coverage : none
8282 tools : flex
8383
@@ -89,71 +89,68 @@ jobs:
8989 env :
9090 SYMFONY_REQUIRE : ${{ matrix.symfony }}
9191
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
9795
98- vendor/bin/simple-phpunit ${CONFIGURATION}
96+ - name : Test
97+ run : vendor/bin/phpunit -c "${PHPUNIT_CONFIG_FILE}"
98+ shell : bash
9999 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' }}
104102
105103 code-coverage :
106104 name : Code Coverage
107105 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
108109 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
116110 mongo :
117111 image : mongo:4
118112 ports :
119113 - 27017:27017
120-
121- env :
122- DATABASE_URL : mysql://root:1234@127.0.0.1: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
125127 steps :
126128 - name : Checkout code
127129 uses : actions/checkout@v3
128130
129- - name : Verify MySQL version
130- run : mysql --host 127.0.0.1 -uroot -p1234 -e "STATUS"
131-
132131 - name : Setup PHP
133132 uses : shivammathur/setup-php@v2
134133 with :
135- php-version : 8.0
136- extensions : pgsql, sqlite
134+ php-version : 8.2
137135 coverage : xdebug
138136 ini-values : xdebug.mode=coverage
139137
140138 - name : Install dependencies
141139 uses : ramsey/composer-install@v2
142140 with :
143141 composer-options : --prefer-dist
144- dependency-versions : " highest"
145142
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
148146 env :
149- USE_ORM : 1
150- USE_ODM : 1
151- USE_FOUNDRY_BUNDLE : 1
147+ USE_FOUNDRY_BUNDLE : 0
148+ SYMFONY_DEPRECATIONS_HELPER : disabled
152149
153150 - name : Publish coverage report to Codecov
154151 uses : codecov/codecov-action@v3
155152 with :
156- file : ./*.clover
153+ file : ./coverage.xml
157154
158155 composer-validate :
159156 uses : zenstruck/.github/.github/workflows/php-composer-validate.yml@main
@@ -189,7 +186,7 @@ jobs:
189186 - name : Setup PHP
190187 uses : shivammathur/setup-php@v2
191188 with :
192- php-version : 8.0
189+ php-version : 8.1
193190 coverage : none
194191
195192 - name : Install dependencies
@@ -209,47 +206,6 @@ jobs:
209206 - name : Run Psalm on factories generated with maker
210207 run : bin/tools/psalm/vendor/vimeo/psalm/psalm
211208
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-
253209 fixcs :
254210 name : Run php-cs-fixer
255211 needs : sync-with-template
@@ -271,4 +227,3 @@ jobs:
271227 with :
272228 key : ${{ secrets.GPG_PRIVATE_KEY }}
273229 token : ${{ secrets.COMPOSER_TOKEN }}
274- phpcsconfig : false
0 commit comments