88 pull_request :
99 workflow_dispatch :
1010
11+ env :
12+ DB_NAME : ' perpl_tests'
13+ DB_USER : ' perpl'
14+ DB_PW : ' perpl'
15+
1116jobs :
1217 testsuite :
1318 name : " Test Suite"
1419 runs-on : ubuntu-24.04
1520 strategy :
1621 fail-fast : false
1722 matrix :
18- php-version : [ '8.1', '8.4 ' ]
23+ php-version : [ '8.1', '8.5 ' ]
1924 db-type : [ sqlite, mysql, pgsql, agnostic ]
20- symfony-version : [ '5 -min', '5 -max', '6 -min', '6 -max', '7 -min', '7 -max']
25+ symfony-version : [ '6 -min', '6 -max', '7 -min', '7 -max', '8 -min', '8 -max']
2126 exclude :
22- - symfony-version : ' 6-min'
23- php-version : ' 8.1'
24- - symfony-version : ' 6-max'
25- php-version : ' 8.1'
2627 - symfony-version : ' 7-min'
2728 php-version : ' 8.1'
2829 - symfony-version : ' 7-max'
2930 php-version : ' 8.1'
30- env :
31- DB_NAME : ' propel_tests'
32- DB_USER : ' propel'
33- DB_PW : ' propel'
34- steps :
35- - name : Install PostgreSQL latest
36- if : matrix.db-type == 'pgsql' && matrix.php-version != '8.1'
37- uses : CasperWA/postgresql-action@v1.2
38- with :
39- postgresql db : $DB_NAME
40- postgresql user : $DB_USER
41- postgresql password : $DB_PW
42-
43- - name : Install PostgreSQL min
44- if : matrix.db-type == 'pgsql' && matrix.php-version == '8.1'
45- uses : CasperWA/postgresql-action@v1.2
46- with :
47- postgresql version : 9
48- postgresql db : $DB_NAME
49- postgresql user : $DB_USER
50- postgresql password : $DB_PW
51-
52- - name : Install MySQL latest
53- if : matrix.db-type == 'mysql' && matrix.php-version != '8.1'
54- uses : mirromutth/mysql-action@v1.1
55- with :
56- mysql root password : $DB_PW
57-
58- - name : Install MariaDb min
59- if : matrix.db-type == 'mysql' && matrix.php-version == '8.1'
60- uses : getong/mariadb-action@v1.1
61- with :
62- mariadb version : ' 10.2'
63- mysql root password : $DB_PW
31+ - symfony-version : ' 8-min'
32+ php-version : ' 8.1'
33+ - symfony-version : ' 8-max'
34+ php-version : ' 8.1'
35+ services :
36+ postgres :
37+ image : ${{ matrix.db-type != 'pgsql' && '' || (matrix.php-version == '8.1' && 'postgres:9' || 'postgres:latest') }}
38+ env :
39+ POSTGRES_DB : ${{ env.DB_NAME }}
40+ POSTGRES_USER : ${{ env.DB_USER }}
41+ POSTGRES_PASSWORD : ${{ env.DB_PW }}
42+ ports :
43+ - 5432:5432
44+ options : >-
45+ --health-cmd pg_isready
46+ --health-interval 10s
47+ --health-timeout 5s
48+ --health-retries 5
49+ mysql :
50+ image : ${{ matrix.db-type != 'mysql' && '' || (matrix.php-version == '8.1' && 'mariadb:10.2' || 'mysql:latest') }}
51+ env :
52+ MYSQL_ROOT_PASSWORD : ${{ env.DB_PW }}
53+ MYSQL_DATABASE : ${{ env.DB_NAME }}
54+ MYSQL_USER : ${{ env.DB_USER }}
55+ MYSQL_PASSWORD : ${{ env.DB_PW }}
56+ ports :
57+ - 3306:3306
58+ options : >-
59+ --health-cmd="mysqladmin ping"
60+ --health-interval=10s
61+ --health-timeout=5s
62+ --health-retries=3
6463
64+ steps :
6565 - uses : actions/checkout@v3
6666
67- - name : Move specific composer.json (Symfony version ${{ matrix.symfony-version }})
68- run : mv tests/composer/composer-symfony${{ matrix.symfony-version }}.json composer.json
69-
7067 - id : build-container
7168 uses : ./.github/actions/setup-php
7269 with :
7370 php-version : ${{ matrix.php-version }}
7471 symfony-version : ${{ matrix.symfony-version }}
7572 cache-key-suffix : ${{ matrix.db-type}}
7673
77- - name : Wait for MySQL server to load
78- if : matrix.db-type == 'mysql'
79- run : |
80- bash -c "
81- for i in {1..10}; do
82- mysqladmin -h 127.0.0.1 -u root status >/dev/null 2>&1 && exit 0 || sleep 6
83- echo 'trying again'
84- done;
85- echo 'could not establish connection after 10 tries'
86- exit 1
87- "
88- env :
89- MYSQL_PWD : ${{ env.DB_PW }}
90-
91- - name : Create MySQL Propel user
74+ - name : Grant MySQL privileges to DB user
9275 if : matrix.db-type == 'mysql'
9376 run : |
9477 mysql -h 127.0.0.1 -u root -e "
95- CREATE USER '$DB_USER'@'localhost' IDENTIFIED BY '$DB_PW';
96- CREATE USER '$DB_USER'@'%' IDENTIFIED BY '$DB_PW';
97- GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'localhost';
98- GRANT ALL PRIVILEGES ON *.* TO '$DB_USER'@'%';
78+ GRANT ALL PRIVILEGES ON *.* TO '${{ env.DB_USER }}'@'%';
9979 FLUSH PRIVILEGES;
10080 "
10181 env :
10686 run : tests/bin/setup.${{ matrix.db-type }}.sh
10787
10888 - name : Run tests
109- shell : ' script -q -e -c " bash {0}" '
89+ shell : bash
11090 run : |
111- if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.symfony-version }} == '5 -max' ]]; then
91+ if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.symfony-version }} == '6 -max' ]]; then
11292 export CODECOVERAGE=1 && vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml --verbose --coverage-clover=tests/coverage.xml
11393 else
11494 vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml
@@ -117,21 +97,30 @@ jobs:
11797 SYMFONY_VERSION : ${{ matrix.symfony-version }}
11898
11999 - name : Code Coverage Report
120- if : success() && matrix.php-version == '8.1' && matrix.symfony-version == '5 -max'
100+ if : success() && matrix.php-version == '8.1' && matrix.symfony-version == '6 -max'
121101 uses : codecov/codecov-action@v1
122102 with :
123103 flags : ${{ matrix.php-version }}, ${{ matrix.db-type }}, ${{ matrix.symfony-version }}
124104 file : tests/coverage.xml
125105
126106 static-analysis :
107+ name : ' Stan & Psalm'
127108 runs-on : ubuntu-24.04
109+ strategy :
110+ fail-fast : false
111+ matrix :
112+ include :
113+ - php-version : ' 8.1'
114+ symfony-version : ' 6-max'
115+ - php-version : ' 8.5'
116+ symfony-version : ' 8-max'
128117 steps :
129118 - uses : actions/checkout@v3
130119 - id : build-container
131120 uses : ./.github/actions/setup-php
132121 with :
133- php-version : 8.1
134- symfony-version : 6-max
122+ php-version : ${{ matrix.php-version }}
123+ symfony-version : ${{ matrix.symfony-version }}
135124 cache-key-suffix : sa
136125 - name : PHPStan
137126 env :
@@ -141,6 +130,7 @@ jobs:
141130 run : composer psalm -- --php-version=${{ steps.build-container.outputs.php-version }}
142131
143132 code-style :
133+ name : ' Code Style (PHPCS)'
144134 runs-on : ubuntu-24.04
145135 steps :
146136 - uses : actions/checkout@v3
@@ -153,53 +143,23 @@ jobs:
153143 - name : Code Style
154144 run : composer cs-check
155145
156- model-code-style :
157- runs-on : ubuntu-24.04
158- steps :
159- - uses : actions/checkout@v3
160- - id : build-container
161- uses : ./.github/actions/setup-php
162- with :
163- php-version : 8.4
164- symfony-version : 6-max
165- cache-key-suffix : cs
166- - name : Lint Model Code
167- run : |
168- bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
169- && composer cs-check tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*[^Query].php
170-
171- model-static-analysis :
172- runs-on : ubuntu-24.04
173- steps :
174- - uses : actions/checkout@v3
175- - id : build-container
176- uses : ./.github/actions/setup-php
177- with :
178- php-version : 8.4
179- symfony-version : 6-max
180- cache-key-suffix : cs
181- - name : Analyze Model Code
182- run : |
183- bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
184- && composer stan -- -a autoload.php.dist tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*[^Query].php
185-
186- query-code-style :
187- runs-on : ubuntu-24.04
188- steps :
189- - uses : actions/checkout@v3
190- - id : build-container
191- uses : ./.github/actions/setup-php
192- with :
193- php-version : 8.4
194- symfony-version : 6-max
195- cache-key-suffix : cs
196- - name : Lint Query Code
197- run : |
198- bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
199- && composer cs-check tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*Query.php
200-
201- query-static-analysis :
146+ generated-code-style :
202147 runs-on : ubuntu-24.04
148+ strategy :
149+ fail-fast : false
150+ matrix :
151+ type : ['query', 'model']
152+ check : ['PHPCS', 'Stan']
153+ include :
154+ - check : PHPCS
155+ command : ' cs-check -- --exclude=SlevomatCodingStandard.TypeHints.DeclareStrictTypes'
156+ - check : Stan
157+ command : ' stan -- -a autoload.php.dist'
158+ - type : query
159+ file-pattern : ' *Query.php'
160+ - type : model
161+ file-pattern : ' *[^Query].php'
162+ name : ' ${{ matrix.check }} on ${{ matrix.type }} code'
203163 steps :
204164 - uses : actions/checkout@v3
205165 - id : build-container
@@ -208,7 +168,7 @@ jobs:
208168 php-version : 8.4
209169 symfony-version : 6-max
210170 cache-key-suffix : cs
211- - name : Analyze Query Code
171+ - name : Run checks on generated code
212172 run : |
213- bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
214- && composer stan -- -a autoload.php.dist tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*Query.php
173+ bin/perpl test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
174+ && composer ${{ matrix.command }} tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/${{ matrix.file-pattern }}
0 commit comments