-
Notifications
You must be signed in to change notification settings - Fork 18
212 lines (178 loc) · 7.23 KB
/
ci.yaml
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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
ES_HTTP_PORT: '59200'
ELASTICSEARCH_HOST: 'localhost'
ELASTICSEARCH_PORT: '59200'
DB_HOST: 127.0.0.1
jobs:
cs-fixer:
name: 'PHP CS Fixer'
runs-on: 'ubuntu-latest'
strategy:
matrix:
php-version:
- '8.2'
steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'
-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'
-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Cache dependencies'
uses: 'actions/cache@v4'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
-
name: 'Install dependencies'
run: 'composer install --no-progress'
-
name: 'Check the code style'
run: 'make cs'
phpstan:
name: 'PhpStan'
runs-on: 'ubuntu-latest'
strategy:
matrix:
php-version:
- '8.2'
steps:
-
name: 'Check out'
uses: 'actions/checkout@v4'
-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'
-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Cache dependencies'
uses: 'actions/cache@v4'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
-
name: 'Install dependencies'
run: 'composer install --no-progress'
-
name: 'Run PhpStan'
run: 'vendor/bin/phpstan analyze --no-progress --error-format=github'
test:
name: 'PHPUnit with PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }}'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
-
php-version: '8.1'
composer-options: '--prefer-stable'
symfony-version: '^6.4'
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^6.4'
-
php-version: '8.2'
composer-options: '--prefer-stable'
symfony-version: '^7.0'
-
php-version: '8.3'
composer-options: '--prefer-stable'
symfony-version: '^7.0'
services:
# https://docs.docker.com/samples/library/postgres/
postgres:
image: postgres:9.6
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: search_tests
ports:
- "5432:5432"
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
# https://docs.docker.com/samples/library/mysql/
mariadb-server:
image: mariadb:10.3
env:
MYSQL_DATABASE: search_tests
MYSQL_ROOT_PASSWORD: nope
ports:
- "3306:3306"
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# https://hub.docker.com/_/elasticsearch/
elasticsearch:
image: elasticsearch:7.3.0
ports:
- "59200:9200"
options: -e="discovery.type=single-node" -e="xpack.security.enabled=false" --health-cmd="curl http://localhost:9200/_cluster/health" --health-interval=10s --health-timeout=5s --health-retries=10
steps:
-
name: Check the Elasticsearch connection from runner host
run: |
curl -fsSL "http://localhost:$ES_HTTP_PORT"
curl -fsSL "http://localhost:$ES_HTTP_PORT/_cluster/health?pretty"
-
name: Checkout
uses: actions/checkout@v4
-
name: 'Set up PHP'
uses: 'shivammathur/setup-php@v2'
with:
php-version: '${{ matrix.php-version }}'
extensions: mbstring, xml, ctype, iconv, intl, bcmath, pdo_sqlite, dom, filter, json, pgsql, pdo, pdo_pgsql, pdo_mysql
coverage: 'xdebug'
env:
update: true
-
name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT'
-
name: 'Cache dependencies'
uses: 'actions/cache@v4'
with:
path: '${{ steps.composer-cache.outputs.cache_dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'
-
name: 'Install dependencies'
env:
COMPOSER_OPTIONS: '${{ matrix.composer-options }}'
SYMFONY_REQUIRE: '${{ matrix.symfony-version }}'
run: |
rm -f composer.lock
composer global config --no-plugins allow-plugins.symfony/flex true
composer global require --no-progress --no-scripts --no-plugins symfony/flex
composer update --no-progress --no-interaction --optimize-autoloader $COMPOSER_OPTIONS
-
name: Run Tests
env:
SYMFONY_DEPRECATIONS_HELPER: weak
run: |
vendor/bin/phpunit --verbose --configuration phpunit.xml.dist
vendor/bin/phpunit --verbose --configuration phpunit/pgsql.xml
vendor/bin/phpunit --verbose --configuration phpunit/mysql.xml