@@ -16,21 +16,43 @@ concurrency:
1616 cancel-in-progress : true
1717
1818jobs :
19+ setup-phpunit-matrix :
20+ runs-on : ubuntu-latest
21+ outputs :
22+ matrix : ${{ steps.gen.outputs.matrix }}
23+ steps :
24+ - uses : actions/checkout@v6
25+ - id : gen
26+ uses : galette/.github/actions/matrix-generator@main
27+ with :
28+ all-jobs : ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-maps' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }}
29+
30+ setup-lint-matrix :
31+ runs-on : ubuntu-latest
32+ outputs :
33+ matrix : ${{ steps.gen.outputs.matrix }}
34+ steps :
35+ - uses : actions/checkout@v6
36+ - id : gen
37+ uses : galette/.github/actions/matrix-generator@main
38+ with :
39+ target : lint
40+ all-jobs : ${{ github.event_name != 'pull_request' && github.repository == 'galette/galette-maps' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')) }}
41+
1942 lint :
2043 runs-on : ubuntu-latest
21- name : " Lint on PHP ${{ matrix.php-versions }}"
44+ needs : setup-lint-matrix
45+ name : " Lint on PHP ${{ matrix.php-version }}"
2246
2347 strategy :
24- matrix :
25- php-versions : [ '8.3', '8.5' ]
26- coverage : [none]
48+ matrix : ${{ fromJSON(needs.setup-lint-matrix.outputs.matrix) }}
2749 fail-fast : false
2850
2951 steps :
3052 - name : PHP
3153 uses : shivammathur/setup-php@v2
3254 with :
33- php-version : ${{ matrix.php-versions }}
55+ php-version : ${{ matrix.php-version }}
3456 tools : composer
3557 coverage : ${{ matrix.coverage }}
3658
7092 ../../vendor/bin/phpcs lib/ ./*.php
7193
7294 - name : CS Fixer
73- if : matrix.php-versions == '8.3'
95+ if : matrix.php-is-min
7496 run : |
7597 cd galette-core/galette/plugins/plugin-maps
7698 ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff
@@ -101,32 +123,13 @@ jobs:
101123
102124 unit-tests :
103125 runs-on : ubuntu-latest
126+ needs : setup-phpunit-matrix
104127
105128 strategy :
106- matrix :
107- include :
108- # always tests higher stable php version with lower db version
109- # enable coverage on higher stable php version with higher PostgreSQL version
110- # cache must be disabled on one always enabled build (not coverage one, this already takes much time than others)
111- # higher stable php version
112- - { php-version: "8.5", db-image: "postgres:13", coverage: none, cache: true, always: true }
113- - { php-version: "8.5", db-image: "postgres:17", coverage: none, cache: true, always: true }
114- - { php-version: "8.5", db-image: "mysql:8.0", coverage: none, cache: true, always: true }
115- - { php-version: "8.5", db-image: "mysql:9.1", coverage: none, cache: true, always: false }
116- - { php-version: "8.5", db-image: "mariadb:10.5", coverage: none, cache: false, always: true }
117- - { php-version: "8.5", db-image: "mariadb:11.6", coverage: none, cache: true, always: false }
118- # always one test with lower php version
119- # lower php version
120- - { php-version: "8.3", db-image: "postgres:13", coverage: none, cache: true, always: false }
121- - { php-version: "8.3", db-image: "postgres:17", coverage: none, cache: true, always: true }
122- - { php-version: "8.3", db-image: "mysql:8.0", coverage: none, cache: true, always: false }
123- - { php-version: "8.3", db-image: "mysql:9.1", coverage: none, cache: true, always: false }
124- - { php-version: "8.3", db-image: "mariadb:10.5", coverage: none, cache: true, always: false }
125- - { php-version: "8.3", db-image: "mariadb:11.6", coverage: none, cache: true, always: false }
129+ matrix : ${{ fromJSON(needs.setup-phpunit-matrix.outputs.matrix) }}
126130 fail-fast : false
127131
128132 env :
129- skip : ${{ matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/plugin-maps' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags'))) }}
130133 DB : ${{ matrix.db-image }}
131134
132135 services :
@@ -158,17 +161,15 @@ jobs:
158161
159162 steps :
160163 - name : PHP
161- if : env.skip != 'true'
162164 uses : shivammathur/setup-php@v2
163165 with :
164- php-version : ${{ matrix.php-versions }}
166+ php-version : ${{ matrix.php-version }}
165167 tools : composer, pecl
166168 coverage : ${{ matrix.coverage }}
167169 extensions : apcu
168170 ini-values : apc.enable_cli=1
169171
170172 - name : " Show versions"
171- if : env.skip != 'true'
172173 run : |
173174 php --version
174175 composer --version
@@ -177,7 +178,6 @@ jobs:
177178 docker exec ${{ job.services.db.id }} bash -c "if [[ -n \$(command -v psql) ]]; then psql --version; else if [[ -n \$(command -v mysql) ]]; then mysql --version; else mariadb --version; fi fi"
178179
179180 - name : Build Galette
180- if : env.skip != 'true'
181181 uses : galette/.github/actions/build-galette@main
182182 with :
183183 php-version : ${{ matrix.php-version }}
@@ -195,18 +195,17 @@ jobs:
195195 cd galette-core
196196 bin/console galette:install -v --dbtype=pgsql --dbhost=localhost --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w
197197 bin/console galette:plugins:install-db --all
198- if : env.skip != 'true' && startsWith(matrix.db-image, 'postgres')
198+ if : startsWith(matrix.db-image, 'postgres')
199199
200200 - name : Init for MariaDB
201201 run : |
202202 cd galette-core
203203 mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306
204204 bin/console galette:install -v --dbtype=mysql --dbhost=127.0.0.1 --dbname=galette_tests --dbuser=galette_tests --dbpass=g@l3tte --admin=admin --password=admin --no-interaction -w
205205 bin/console galette:plugins:install-db --all
206- if : env.skip != 'true' && ( startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') )
206+ if : startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb')
207207
208208 - name : Unit tests
209- if : env.skip != 'true'
210209 run : |
211210 cd galette-core/galette/plugins/plugin-maps
212211 ../../vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GaletteMaps/
0 commit comments