@@ -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-objectslend' && (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-objectslend' && (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-objectslend
7698 ../../vendor/bin/php-cs-fixer check --show-progress=dots --verbose --diff
@@ -92,32 +114,13 @@ jobs:
92114
93115 unit-tests :
94116 runs-on : ubuntu-latest
117+ needs : setup-phpunit-matrix
95118
96119 strategy :
97- matrix :
98- include :
99- # always tests higher stable php version with lower db version
100- # enable coverage on higher stable php version with higher PostgreSQL version
101- # cache must be disabled on one always enabled build (not coverage one, this already takes much time than others)
102- # higher stable php version
103- - { php-version: "8.5", db-image: "postgres:13", coverage: none, cache: true, always: true }
104- - { php-version: "8.5", db-image: "postgres:17", coverage: none, cache: true, always: true }
105- - { php-version: "8.5", db-image: "mysql:8.0", coverage: none, cache: true, always: true }
106- - { php-version: "8.5", db-image: "mysql:9.1", coverage: none, cache: true, always: false }
107- - { php-version: "8.5", db-image: "mariadb:10.5", coverage: none, cache: false, always: true }
108- - { php-version: "8.5", db-image: "mariadb:11.6", coverage: none, cache: true, always: false }
109- # always one test with lower php version
110- # lower php version
111- - { php-version: "8.3", db-image: "postgres:13", coverage: none, cache: true, always: false }
112- - { php-version: "8.3", db-image: "postgres:17", coverage: none, cache: true, always: true }
113- - { php-version: "8.3", db-image: "mysql:8.0", coverage: none, cache: true, always: false }
114- - { php-version: "8.3", db-image: "mysql:9.1", coverage: none, cache: true, always: false }
115- - { php-version: "8.3", db-image: "mariadb:10.5", coverage: none, cache: true, always: false }
116- - { php-version: "8.3", db-image: "mariadb:11.6", coverage: none, cache: true, always: false }
120+ matrix : ${{ fromJSON(needs.setup-phpunit-matrix.outputs.matrix) }}
117121 fail-fast : false
118122
119123 env :
120- skip : ${{ matrix.always == false && (github.event_name == 'pull_request' || github.repository != 'galette/plugin-objectslend' || !(github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags'))) }}
121124 DB : ${{ matrix.db-image }}
122125
123126 services :
@@ -149,17 +152,15 @@ jobs:
149152
150153 steps :
151154 - name : PHP
152- if : env.skip != 'true'
153155 uses : shivammathur/setup-php@v2
154156 with :
155- php-version : ${{ matrix.php-versions }}
157+ php-version : ${{ matrix.php-version }}
156158 tools : composer, pecl
157159 coverage : ${{ matrix.coverage }}
158160 extensions : apcu
159161 ini-values : apc.enable_cli=1
160162
161163 - name : " Show versions"
162- if : env.skip != 'true'
163164 run : |
164165 php --version
165166 composer --version
@@ -168,7 +169,6 @@ jobs:
168169 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"
169170
170171 - name : Build Galette
171- if : env.skip != 'true'
172172 uses : galette/.github/actions/build-galette@main
173173 with :
174174 php-version : ${{ matrix.php-version }}
@@ -186,18 +186,17 @@ jobs:
186186 cd galette-core
187187 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
188188 bin/console galette:plugins:install-db --all
189- if : env.skip != 'true' && startsWith(matrix.db-image, 'postgres')
189+ if : startsWith(matrix.db-image, 'postgres')
190190
191191 - name : Init for MariaDB
192192 run : |
193193 cd galette-core
194194 mysql -e 'create database IF NOT EXISTS galette_tests;' -u galette_tests --password=g@l3tte -h 127.0.0.1 -P 3306
195195 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
196196 bin/console galette:plugins:install-db --all
197- if : env.skip != 'true' && ( startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb') )
197+ if : startsWith(matrix.db-image, 'mysql') || startsWith(matrix.db-image, 'mariadb')
198198
199199 - name : Unit tests
200- if : env.skip != 'true'
201200 run : |
202201 cd galette-core/galette/plugins/plugin-objectslend
203202 ../../vendor/bin/phpunit --test-suffix=.php --bootstrap tests/TestsBootstrap.php --no-coverage --process-isolation tests/GaletteObjectsLend/
0 commit comments