-
Notifications
You must be signed in to change notification settings - Fork 5
304 lines (261 loc) · 9.55 KB
/
Copy pathci-php.yml
File metadata and controls
304 lines (261 loc) · 9.55 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
name: NeoWiki CI (PHP)
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/workflows/ci-ts.yml'
- '.github/workflows/ci-redherb.yml'
- '.github/workflows/neo-ci-ts.yml'
- 'resources/**'
- 'Neo/neojs/**'
pull_request:
paths-ignore:
- '.github/workflows/ci-ts.yml'
- '.github/workflows/ci-redherb.yml'
- '.github/workflows/neo-ci-ts.yml'
- 'resources/**'
- 'Neo/neojs/**'
jobs:
test:
name: "PHPUnit: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
strategy:
fail-fast: false
matrix:
include:
- mw: 'REL1_43'
php: '8.3'
runs-on: ubuntu-latest
env:
NEO4J_URL_OVERRIDE: bolt://neo4j:password@localhost:7689
NEO4J_URL_READ_OVERRIDE: bolt://mediawiki_read:mediawiki_read@localhost:7689
# Live QLever store for the SPARQL query system test. Overrides the dev-stack hostname in
# phpunit.xml.dist (PHPUnit <env> does not override an existing environment variable), so the test
# reaches the QLever the "Start QLever" step publishes on the runner's localhost.
QLEVER_TEST_URL: http://localhost:7019/
QLEVER_TEST_ACCESS_TOKEN: neowiki_test_token
services:
test_neo:
image: neo4j:enterprise
ports:
- 7689:7689
- 7475:7475
env:
NEO4J_ACCEPT_LICENSE_AGREEMENT: eval
NEO4J_AUTH: neo4j/password
NEO4J_server_bolt_listen__address: :7689
NEO4J_server_http_listen__address: :7475
options: --name test_neo --hostname test_neo
defaults:
run:
working-directory: mediawiki
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
tools: composer
- name: Disable Composer block-insecure
working-directory: ~
run: composer config --global audit.block-insecure false
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v5
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}
- name: Cache Composer cache
uses: actions/cache@v5
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}
- uses: actions/checkout@v6
with:
path: EarlyCopy
- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} NeoWiki
- uses: actions/checkout@v6
with:
path: mediawiki/extensions/NeoWiki
- name: Load RedHerb test extension
run: echo 'wfLoadExtension( "RedHerb", "$IP/extensions/NeoWiki/tests/RedHerb/extension.json" );' >> LocalSettings.php
- run: composer update
- name: Wait for Neo4j
uses: iFaxity/wait-on-action@v1
with:
resource: http-get://localhost:7689
timeout: 60000
# QLever for the SPARQL query system test. It cannot be a `services:` container: its bring-up needs
# a multi-step entrypoint (build an empty index, then serve) that a service container cannot express
# (no command/args, only an image + options). So it is started explicitly, like the "Create neo4j
# user" docker step below. --persist-updates is omitted: the store is fresh per CI run and the test
# clears it, so keeping updates in memory is enough. The index is built in /tmp rather than the dev
# stack's /index: the image runs as a non-root user with no /index (the dev stack provides it via a
# volume), so a bare `docker run` must use an already-writable in-image path.
# --service-allowed-iri-prefixes disables SPARQL federation, matching the dev stack (see
# Docker/docker-compose.dev.yml): QLever allows every SERVICE IRI unless the option is given, and "-"
# is the documented deny-all value (an invalid prefix no IRI matches). No test federates.
- name: Start QLever
run: |
docker run -d --name test_qlever -p 7019:7019 -e QLEVER_ACCESS_TOKEN=neowiki_test_token \
--entrypoint /bin/bash docker.io/adfreiburg/qlever:latest -lc '
set -e
cd /tmp
: > data.nt
qlever-index -i neowiki -F nt -f data.nt
exec qlever-server -i neowiki -p 7019 -a "$QLEVER_ACCESS_TOKEN" -m 1G --service-allowed-iri-prefixes -'
- name: Run update.php
run: php maintenance/update.php --quick
- name: Create neo4j user
run: docker exec test_neo bash -c \
"echo \"CREATE USER mediawiki_read SET PASSWORD 'mediawiki_read' CHANGE NOT REQUIRED; GRANT ROLE reader TO mediawiki_read;\" | cypher-shell -u neo4j -p password -a bolt://localhost:7689"
- name: Wait for QLever
run: |
for i in $(seq 1 40); do
if curl -fsS -o /dev/null "http://localhost:7019/?query=SELECT%20%2A%20WHERE%20%7B%20%3Fs%20%3Fp%20%3Fo%20%7D%20LIMIT%201"; then
echo "QLever is serving"; exit 0
fi
sleep 2
done
echo "QLever did not become ready in time; dumping logs:"; docker logs test_qlever; exit 1
- name: Run PHPUnit
run: php tests/phpunit/phpunit.php -c extensions/NeoWiki/phpunit.xml.dist
phpcs:
name: "PHPCS with PHP 8.3"
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Checkout NeoExtension
uses: actions/checkout@v6
- name: Install dependencies
run: composer install
- name: Run PHPCS
run: vendor/bin/phpcs -p -s --standard=phpcs.xml
PHPStan:
name: "PHPStan: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
strategy:
matrix:
include:
- mw: 'REL1_43'
php: '8.3'
runs-on: ubuntu-latest
defaults:
run:
working-directory: mediawiki
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, intl
tools: composer
- name: Disable Composer block-insecure
working-directory: ~
run: composer config --global audit.block-insecure false
- name: Cache MediaWiki
id: cache-mediawiki
uses: actions/cache@v5
with:
path: |
mediawiki
!mediawiki/extensions/
!mediawiki/vendor/
key: mw_${{ matrix.mw }}-php${{ matrix.php }}
- name: Cache Composer cache
uses: actions/cache@v5
with:
path: ~/.composer/cache
key: composer-php${{ matrix.php }}
- uses: actions/checkout@v6
with:
path: EarlyCopy
- name: Install MediaWiki
if: steps.cache-mediawiki.outputs.cache-hit != 'true'
working-directory: ~
run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} NeoWiki
- uses: actions/checkout@v6
with:
path: mediawiki/extensions/NeoWiki
- run: composer update
- name: Composer install
run: cd extensions/NeoWiki && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
- name: PHPStan
run: cd extensions/NeoWiki && vendor/bin/phpstan analyze --configuration=phpstan.neon --memory-limit=2G
# Psalm:
# name: "Psalm: MW ${{ matrix.mw }}, PHP ${{ matrix.php }}"
#
# continue-on-error: true # TODO
#
# strategy:
# matrix:
# include:
# - mw: 'master'
# php: '8.3'
#
# runs-on: ubuntu-latest
#
# defaults:
# run:
# working-directory: mediawiki
#
# steps:
# - name: Setup PHP
# uses: shivammathur/setup-php@v2
# with:
# php-version: ${{ matrix.php }}
# extensions: mbstring, intl
# tools: composer
#
# - name: Cache MediaWiki
# id: cache-mediawiki
# uses: actions/cache@v5
# with:
# path: |
# mediawiki
# !mediawiki/extensions/
# !mediawiki/vendor/
# key: mw_${{ matrix.mw }}-php${{ matrix.php }}
#
# - name: Cache Composer cache
# uses: actions/cache@v5
# with:
# path: ~/.composer/cache
# key: composer-php${{ matrix.php }}
#
# - uses: actions/checkout@v6
# with:
# path: EarlyCopy
#
# - name: Install MediaWiki
# if: steps.cache-mediawiki.outputs.cache-hit != 'true'
# working-directory: ~
# run: bash EarlyCopy/.github/workflows/installMediaWiki.sh ${{ matrix.mw }} NeoWiki
#
# - uses: actions/checkout@v6
# with:
# path: mediawiki/extensions/NeoWiki
#
# - uses: actions/checkout@v6
# with:
# repository: ProfessionalWiki/Neo
# path: mediawiki/extensions/NeoWiki/Neo
# token: ${{ secrets.NEO_READ_FPAT }}
# # Expected to expire on Sep 12 2025
# # https://github.com/organizations/ProfessionalWiki/settings/secrets/actions/NEO_READ_FPAT (enter new value)
# # (Re)generate token with contents read access for Neo and NeoExtension at https://github.com/settings/tokens?type=beta
#
# - run: composer update
#
# - name: Composer install
# run: cd extensions/NeoWiki && composer install --no-progress --no-interaction --prefer-dist --optimize-autoloader
#
# - name: Psalm
# run: cd extensions/NeoWiki && vendor/bin/psalm --config=psalm.xml --no-diff