-
-
Notifications
You must be signed in to change notification settings - Fork 27
229 lines (190 loc) · 7.3 KB
/
ci.yml
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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: CI
on:
workflow_dispatch: ~
push:
branches:
- 2.x
pull_request: ~
jobs:
lint:
name: Lint
runs-on: 'ubuntu-latest'
timeout-minutes: 5
steps:
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: none
- name: 'Require Doctrine MongoDB dependencies'
run: composer require --no-update --ignore-platform-reqs --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.4" "doctrine/mongodb-odm-bundle:^4.5.1"
- name: 'Install dependencies'
id: deps
run: |
echo "::group::Install project deps"
composer update --prefer-dist --ignore-platform-reqs --ansi
echo "::endgroup::"
echo "::group::Install PHPUnit"
vendor/bin/simple-phpunit install
echo "::endgroup::"
env:
SYMFONY_REQUIRE: "6.4*dev"
- name: 'Lint - PHP CS Fixer'
if: always() && steps.deps.outcome == 'success'
run: |
echo "::group::Install PHP CS Fixer"
make php-cs-fixer.phar
echo "::endgroup::"
./php-cs-fixer.phar fix --dry-run --no-interaction --diff
- name: 'Lint - PHPStan'
if: always() && steps.deps.outcome == 'success'
run: ./vendor/bin/phpstan
test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 15
continue-on-error: ${{ matrix.allow-failure == 1 }}
strategy:
fail-fast: false
matrix:
include:
# Lowest deps
- name: 'Test lowest deps [Linux, PHP 8.1]'
os: 'ubuntu-latest'
php: '8.1'
composer-flags: '--prefer-lowest'
allow-unstable: true
mongodb: true
# Previous Symfony versions
# …
# Previous PHP versions
# …
# Most recent versions
- name: 'Test Symfony 5.4 [Linux, PHP 8.1]'
os: 'ubuntu-latest'
php: '8.1'
symfony: '5.4.*@dev'
allow-unstable: true
mongodb: true
mysql: true
- name: 'Test Symfony 5.4 [Windows, PHP 8.1]'
os: 'windows-latest'
php: '8.1'
symfony: '5.4.*@dev'
mongodb: true
mysql: true
allow-unstable: true
- name: 'Test Symfony 6.3 [Linux, PHP 8.1]'
os: 'ubuntu-latest'
php: '8.1'
symfony: '6.3.*@dev'
mongodb: true
mysql: true
allow-unstable: true
- name: 'Test Symfony 6.4 [Linux, PHP 8.1]'
os: 'ubuntu-latest'
php: '8.1'
symfony: '6.4.*@dev'
allow-unstable: true
mysql: true
mongodb: true
- name: 'Test Symfony 7.0 [Linux, PHP 8.2]'
os: 'ubuntu-latest'
php: '8.2'
symfony: '7.0.*@dev'
allow-unstable: true
mysql: true
mongodb: true
mongodbnew: true
# Bleeding edge (unreleased dev versions where failures are allowed)
- name: 'Test next Symfony 7.1 [Linux, PHP 8.2] (allowed failure)'
os: 'ubuntu-latest'
php: '8.2'
symfony: '7.1.*@dev'
composer-flags: '--ignore-platform-req php'
allow-unstable: true
allow-failure: true
mysql: true
mongodb: true
mongodbnew: true
- name: 'Test next Symfony 7.1 [Linux, PHP 8.3] (allowed failure)'
os: 'ubuntu-latest'
php: '8.3'
symfony: '7.1.*@dev'
composer-flags: '--ignore-platform-req php'
allow-unstable: true
allow-failure: true
mysql: true
mongodb: true
mongodbnew: true
steps:
- name: 'Set git to use LF'
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: 'Checkout'
uses: actions/checkout@v3
- name: 'Setup PHP'
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pdo_sqlite ${{ matrix.mongodb && ', mongodb' }} ${{ matrix.mysql && ', pdo_mysql' }}
coverage: none
tools: 'composer:v2,flex'
- name: 'Start MongoDB (Linux)'
uses: supercharge/[email protected]
if: ${{ matrix.mongodb && matrix.os == 'ubuntu-latest' }}
- name: 'Start MongoDB (Windows)'
uses: crazy-max/ghaction-chocolatey@v3
with:
args: install mongodb.install --version=7.0.4 --allow-downgrade
if: ${{ matrix.mongodb && matrix.os == 'windows-latest' }}
- name: 'Shutdown Default Ubuntu MySQL'
run: sudo service mysql stop
if: ${{ matrix.mysql && matrix.os == 'ubuntu-latest' }}
- name: 'Setup MySQL'
uses: ankane/setup-mysql@v1
with:
mysql-version: '8.0.35'
database: doctrine_tests
if: ${{ matrix.mysql }}
- name: 'Get composer cache directory'
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
if: ${{ matrix.os != 'windows-latest' }}
- name: 'Cache dependencies'
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-php-${{ matrix.php }}-symfony-${{ matrix.symfony }}-${{ hashFiles('**/composer.json') }}-flags-${{ matrix.composer-flags }}
restore-keys: ${{ runner.os }}-composer-
if: ${{ matrix.os != 'windows-latest' }}
- name: 'Allow unstable packages'
run: composer config minimum-stability dev
if: ${{ matrix.allow-unstable }}
- name: 'Require Doctrine MongoDB dependencies for old symfony'
run: composer require --no-update ${{ matrix.composer-flags }} --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.4" "doctrine/mongodb-odm-bundle:^4.5.1"
if: ${{ matrix.mongodb && !matrix.mongodbnew }}
- name: 'Require Doctrine MongoDB dependencies for new symfony'
run: composer require --no-update ${{ matrix.composer-flags }} --dev --no-interaction --ansi "doctrine/mongodb-odm:^2.6" "doctrine/mongodb-odm-bundle:5.0.x-dev"
if: ${{ matrix.mongodb && matrix.mongodbnew }}
- name: 'Install dependencies'
run: |
echo "::group::Install project deps"
composer update --prefer-dist ${{ matrix.composer-flags }} --ansi
echo "::endgroup::"
echo "::group::Install PHPUnit"
vendor/bin/simple-phpunit install
echo "::endgroup::"
env:
SYMFONY_REQUIRE: "${{ matrix.symfony }}"
- name: 'Set Doctrine MySQL DSN (Linux)'
run: echo "DOCTRINE_DBAL_URL=pdo-mysql://[email protected]:3306/doctrine_tests?serverVersion=8.0.35" >> $GITHUB_ENV
if: ${{ matrix.mysql && matrix.os == 'ubuntu-latest' }}
- name: 'Set Doctrine MySQL DSN (Windows)'
run: echo "DOCTRINE_DBAL_URL=pdo-mysql://[email protected]:3306/doctrine_tests?serverVersion=8.0.35" >> $env:GITHUB_ENV
if: ${{ matrix.mysql && matrix.os == 'windows-latest' }}
- name: 'Run PHPUnit tests'
run: vendor/bin/simple-phpunit --testdox --verbose