Repository navigation
235 lines (212 loc) · 8.15 KB
/
Copy pathci.yml
File metadata and controls
235 lines (212 loc) · 8.15 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
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
230
231
232
233
234
235
name: CI
on:
pull_request:
push:
branches:
- develop
- main
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Tests
runs-on: ubuntu-latest
services:
# Redis integration suites (packages/cache-redis, packages/ratelimiter)
# skip without a server; this keeps them running on every build.
redis:
image: public.ecr.aws/docker/library/redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 3s
--health-retries 10
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: sockets
coverage: none
ini-values: memory_limit=2G
- name: Install dependencies
uses: ramsey/composer-install@v3
# Excludes integration-destructive: that group deletes vendor/ and composer.lock,
# runs `composer update`, and re-runs the whole suite in a subprocess. It verifies
# install integrity rather than application behaviour, so it runs on the nightly
# schedule below and is enforced again by bin/release.sh before any tag is cut.
- name: Run test suite
run: composer test
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: sockets
coverage: none
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: PHP_CodeSniffer
run: vendor/bin/phpcs --standard=phpcs.xml
- name: PHP CS Fixer
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --diff
- name: Docs class references
if: ${{ !cancelled() }}
run: composer docs:lint
static:
name: Static analysis
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: sockets
coverage: none
ini-values: memory_limit=2G
- name: Install dependencies
uses: ramsey/composer-install@v3
- name: PHPStan
run: composer phpstan
# Runs the integration-services group against real services: the fixture app
# in tests/Integration/App (Postgres and Redis), the database-pgsql and
# database-mysql driver integration tests (MARKO_TEST_PGSQL_* and
# MARKO_TEST_MYSQL_*) and the live Redis tests of pubsub-redis and
# broadcasting-amphp. The database-mysql driver tests then run a second time
# against MariaDB. MARKO_INTEGRATION_REQUIRED turns "service unreachable
# or not configured" into a failure, so this job can never pass by skipping.
integration:
name: Integration
runs-on: ubuntu-latest
services:
postgres:
image: public.ecr.aws/docker/library/postgres:17
env:
POSTGRES_USER: marko
POSTGRES_PASSWORD: marko
POSTGRES_DB: marko_integration
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U marko -d marko_integration"
--health-interval 5s
--health-timeout 5s
--health-retries 10
mysql:
image: public.ecr.aws/docker/library/mysql:8.4
env:
MYSQL_ROOT_PASSWORD: marko
MYSQL_DATABASE: marko_test
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -uroot -pmarko"
--health-interval 5s
--health-timeout 5s
--health-retries 20
# MariaDB-only paths (1020 snapshot conflicts, 4025 check failures, JSON
# stored as LONGTEXT) run only against MariaDB. 11.8 is the first LTS
# with innodb_snapshot_isolation=ON by default.
mariadb:
image: public.ecr.aws/docker/library/mariadb:11.8
env:
MARIADB_ROOT_PASSWORD: marko
MARIADB_DATABASE: marko_test
ports:
- 3307:3306
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 5s
--health-timeout 5s
--health-retries 20
# The oldest MariaDB LTS still supported. The MySQL driver suite runs
# against it too, so the documented floor is tested.
mariadb-10-11:
image: public.ecr.aws/docker/library/mariadb:10.11
env:
MARIADB_ROOT_PASSWORD: marko
MARIADB_DATABASE: marko_test
ports:
- 3308:3306
options: >-
--health-cmd "healthcheck.sh --connect --innodb_initialized"
--health-interval 5s
--health-timeout 5s
--health-retries 20
redis:
image: public.ecr.aws/docker/library/redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DB_HOST: 127.0.0.1
DB_PORT: 5432
DB_USERNAME: marko
DB_PASSWORD: marko
DB_DATABASE: marko_integration
REDIS_HOST: 127.0.0.1
REDIS_PORT: 6379
# The pgsql driver tests use their own database on the same server: the
# fixture suite drops marko_integration before every case.
MARKO_TEST_PGSQL_HOST: 127.0.0.1
MARKO_TEST_PGSQL_PORT: 5432
MARKO_TEST_PGSQL_DATABASE: marko_test
MARKO_TEST_PGSQL_USERNAME: marko
MARKO_TEST_PGSQL_PASSWORD: marko
MARKO_TEST_MYSQL_HOST: 127.0.0.1
MARKO_TEST_MYSQL_PORT: 3306
MARKO_TEST_MYSQL_DATABASE: marko_test
MARKO_TEST_MYSQL_USERNAME: root
MARKO_TEST_MYSQL_PASSWORD: marko
# Fails a run that reached the other server (see ServerIdentityTest)
MARKO_TEST_MYSQL_SERVER: mysql
MARKO_INTEGRATION_REQUIRED: '1'
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: sockets, pdo_pgsql, pdo_mysql
coverage: none
ini-values: memory_limit=2G
- name: Install dependencies
uses: ramsey/composer-install@v3
# Service containers cannot mount tests/Integration/postgres-init, so the
# database the local compose file creates on startup is created here.
- name: Create the pgsql driver test database
run: docker exec ${{ job.services.postgres.id }} createdb -U marko marko_test
- name: Run integration suite
run: composer test:integration
# Only the MySQL suites run again against each MariaDB: the MySQL driver
# suite, the admin-auth MySQL repository tests, the queue-database and
# session-database MySQL tests, the search driver's reserved-word tests,
# and the fresh db:migrate of the queue and session tables. The fixture
# app and the other suites do not touch MySQL.
- name: Run MySQL integration suites against MariaDB 11.8
env:
MARKO_TEST_MYSQL_PORT: 3307
MARKO_TEST_MYSQL_SERVER: mariadb
run: php -d memory_limit=2G vendor/bin/pest -c phpunit.xml --group=integration-services packages/database-mysql/tests/Integration packages/admin-auth/tests/Integration/MySql packages/queue-database/tests/Integration/MySqlRoundTripTest.php packages/session-database/tests/Integration/MySql packages/search/tests/Integration/MySql tests/Integration/App/QueueSessionTablesMySqlTest.php
- name: Run MySQL integration suites against MariaDB 10.11
env:
MARKO_TEST_MYSQL_PORT: 3308
MARKO_TEST_MYSQL_SERVER: mariadb
run: php -d memory_limit=2G vendor/bin/pest -c phpunit.xml --group=integration-services packages/database-mysql/tests/Integration packages/admin-auth/tests/Integration/MySql packages/queue-database/tests/Integration/MySqlRoundTripTest.php packages/session-database/tests/Integration/MySql packages/search/tests/Integration/MySql tests/Integration/App/QueueSessionTablesMySqlTest.php