forked from propelorm/Propel2
-
Notifications
You must be signed in to change notification settings - Fork 4
192 lines (179 loc) · 6.96 KB
/
ci.yml
File metadata and controls
192 lines (179 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
name: CI
on:
push:
branches:
- 'main'
- 'develop'
pull_request:
workflow_dispatch:
jobs:
testsuite:
name: "Test Suite"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php-version: [ '8.1', '8.5' ]
db-type: [ sqlite, mysql, pgsql, agnostic ]
symfony-version: [ '6-min', '6-max', '7-min', '7-max', '8-min', '8-max']
exclude:
- symfony-version: '7-min'
php-version: '8.1'
- symfony-version: '7-max'
php-version: '8.1'
- symfony-version: '8-min'
php-version: '8.1'
- symfony-version: '8-max'
php-version: '8.1'
services:
postgres:
image: ${{ matrix.php-version == '8.1' && 'postgres:9' || 'postgres:latest' }}
env:
POSTGRES_DB: propel_tests
POSTGRES_USER: propel
POSTGRES_PASSWORD: propel
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: ${{ matrix.php-version == '8.1' && 'mariadb:10.2' || 'mysql:latest' }}
env:
MYSQL_ROOT_PASSWORD: propel
MYSQL_DATABASE: propel_tests
MYSQL_USER: propel
MYSQL_PASSWORD: propel
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
DB_NAME: 'propel_tests'
DB_USER: 'propel'
DB_PW: 'propel'
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: ${{ matrix.php-version }}
symfony-version: ${{ matrix.symfony-version }}
cache-key-suffix: ${{ matrix.db-type}}
- name: Grant MySQL privileges to propel user
if: matrix.db-type == 'mysql'
run: |
mysql -h 127.0.0.1 -u root -e "
GRANT ALL PRIVILEGES ON *.* TO 'propel'@'%';
FLUSH PRIVILEGES;
"
env:
MYSQL_PWD: propel
- name: Setup database for test suite
if: matrix.db-type != 'agnostic'
run: tests/bin/setup.${{ matrix.db-type }}.sh
- name: Run tests
shell: bash
run: |
if [[ ${{ matrix.php-version }} == '8.1' && ${{ matrix.symfony-version }} == '6-max' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml --verbose --coverage-clover=tests/coverage.xml
else
vendor/bin/phpunit -c tests/${{ matrix.db-type }}.phpunit.xml
fi
env:
SYMFONY_VERSION: ${{ matrix.symfony-version }}
- name: Code Coverage Report
if: success() && matrix.php-version == '8.1' && matrix.symfony-version == '6-max'
uses: codecov/codecov-action@v1
with:
flags: ${{ matrix.php-version }}, ${{ matrix.db-type }}, ${{ matrix.symfony-version }}
file: tests/coverage.xml
static-analysis:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.1
symfony-version: 6-max
cache-key-suffix: sa
- name: PHPStan
env:
PHPSTAN: 1
run: composer stan
- name: Psalm
run: composer psalm -- --php-version=${{ steps.build-container.outputs.php-version }}
code-style:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Code Style
run: composer cs-check
model-code-style:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Lint Model Code
run: |
bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
&& composer cs-check tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*[^Query].php
model-static-analysis:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Analyze Model Code
run: |
bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
&& composer stan -- -a autoload.php.dist tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*[^Query].php
query-code-style:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Lint Query Code
run: |
bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
&& composer cs-check tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*Query.php
query-static-analysis:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- id: build-container
uses: ./.github/actions/setup-php
with:
php-version: 8.4
symfony-version: 6-max
cache-key-suffix: cs
- name: Analyze Query Code
run: |
bin/propel test:prepare --vendor=sqlite --dsn='sqlite:/tmp/perpl.sq3' --exclude-database \
&& composer stan -- -a autoload.php.dist tests/Fixtures/bookstore/build/classes/Propel/Tests/Bookstore/Base/*Query.php