@@ -161,211 +161,3 @@ jobs:
161
161
draft : false
162
162
prerelease : false
163
163
164
- end-to-end-release-zip-test :
165
- strategy :
166
- fail-fast : false
167
- # First and last minor versions of each major version
168
- # Highest compatible PHP version
169
- matrix :
170
- include :
171
- - wp-version : ' 4.9'
172
- php-version : ' 7.2'
173
- - wp-version : ' 5.0'
174
- php-version : ' 7.2'
175
- - wp-version : ' 5.9'
176
- php-version : ' 7.2'
177
- - wp-version : ' 5.9'
178
- php-version : ' 8.0'
179
- - wp-version : ' 6.0'
180
- php-version : ' 7.2'
181
- - wp-version : ' 6.0'
182
- php-version : ' 8.0'
183
- - wp-version : ' 6.7'
184
- php-version : ' 7.2'
185
- - wp-version : ' 6.7'
186
- php-version : ' 8.3'
187
-
188
- name : End-to-end release test suite
189
- runs-on : ubuntu-latest
190
- if : success()
191
- needs : [ deploy-create-release ]
192
-
193
- env :
194
- EXTENSION_NAME : " CrowdSec_Bouncer"
195
- EXTENSION_PATH : " wp-content/plugins/crowdsec"
196
- GITHUB_ORIGIN : " crowdsecurity/cs-wordpress-bouncer"
197
-
198
- steps :
199
-
200
- - name : Install DDEV
201
- # @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
202
- run : |
203
- curl -fsSL https://apt.fury.io/drud/gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/ddev.gpg > /dev/null
204
- echo "deb [signed-by=/etc/apt/trusted.gpg.d/ddev.gpg] https://apt.fury.io/drud/ * *" | sudo tee /etc/apt/sources.list.d/ddev.list
205
- sudo apt-get -q update
206
- sudo apt-get -q -y install libnss3-tools ddev
207
- mkcert -install
208
- ddev config global --instrumentation-opt-in=false --omit-containers=ddev-ssh-agent
209
-
210
- - name : Set WP_VERSION_CODE env
211
- # used in some directory path and conventional file naming
212
- # Example : 5.6.5 => wp565
213
- id : set-wp-version-code
214
- run : |
215
- echo "wp_version_code=$(echo wp${{ matrix.wp-version }} | sed 's/\.//g' )" >> $GITHUB_OUTPUT
216
-
217
- - name : Create empty WordPress DDEV project (with Apache)
218
- run : ddev config --project-type=wordpress --project-name=${{ steps.set-wp-version-code.outputs.wp_version_code }} --php-version=${{ matrix.php-version }} --webserver-type=apache-fpm
219
-
220
- - name : Disable automatic update
221
- run : |
222
- # @see https://wordpress.org/documentation/article/configuring-automatic-background-updates/#constant-to-disable-all-updates
223
- sed -i -e 's/#ddev-generated//g' wp-config-ddev.php
224
- echo "define( 'AUTOMATIC_UPDATER_DISABLED', true );" >> wp-config-ddev.php
225
-
226
- - name : Add Redis, Memcached, Crowdsec and Playwright
227
- run : |
228
- ddev get ddev/ddev-redis
229
- ddev get ddev/ddev-memcached
230
- ddev get julienloizelet/ddev-playwright
231
- # override redis.conf
232
- ddev get julienloizelet/ddev-tools
233
- ddev get julienloizelet/ddev-crowdsec-php
234
-
235
- - name : Start DDEV
236
- uses : nick-fields/retry@v3
237
- with :
238
- timeout_minutes : 5
239
- max_attempts : 3
240
- shell : bash
241
- command : |
242
- ddev start
243
-
244
- - name : Download WordPress
245
- run : ddev wp core download --version=${{ matrix.wp-version }}
246
-
247
- - name : Setup WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
248
- run : |
249
- ddev exec wp core install --url='https://${{ steps.set-wp-version-code.outputs.wp_version_code }}.ddev.site' --title='WordPress' --admin_user='admin' --admin_password='admin123' --admin_email='admin@admin.com'
250
-
251
- - name : Set LAST_TAG env
252
- id : set-last-tag
253
- run : |
254
- echo "last_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/${{ env.GITHUB_ORIGIN }}/releases/latest | grep -oP "\/tag\/v\K(.*)$")" >> $GITHUB_OUTPUT
255
-
256
- - name : Clone files from last release
257
- uses : actions/checkout@v4
258
- with :
259
- path : raw_sources
260
- ref : " v${{ steps.set-last-tag.outputs.last_tag }}"
261
- repository : " ${{ env.GITHUB_ORIGIN }}"
262
-
263
- - name : Retrieve last stable release zip
264
- run : |
265
- curl -fL https://downloads.wordpress.org/plugin/crowdsec.${{ steps.set-last-tag.outputs.last_tag }}.zip -o crowdsec.$LAST_TAG.zip
266
- unzip crowdsec.${{ steps.set-last-tag.outputs.last_tag }}.zip -d ${{ github.workspace }}/wp-content/plugins
267
-
268
- - name : Copy needed tests files
269
- run : |
270
- cp -r raw_sources/tests wp-content/plugins/crowdsec
271
- cp -r raw_sources/.github wp-content/plugins/crowdsec
272
-
273
- - name : Prepare for playwright test
274
- run : |
275
- ddev exec -s crowdsec apk add iproute2
276
- cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/wp_appsec_custom_upload.php wp_appsec_custom_upload.php
277
- cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-upload.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec Upload" -
278
- cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec" -
279
- ddev wp rewrite structure "/%postname%/"
280
- mkdir -p crowdsec/tls
281
- mkdir -p crowdsec/geolocation
282
- cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
283
- cp -r .ddev/okaeli-add-on/custom_files/crowdsec/cfssl/* crowdsec/tls
284
- ddev maxmind-download DEFAULT GeoLite2-City crowdsec/geolocation
285
- ddev maxmind-download DEFAULT GeoLite2-Country crowdsec/geolocation
286
- cd crowdsec/geolocation
287
- sha256sum -c GeoLite2-Country.tar.gz.sha256.txt
288
- sha256sum -c GeoLite2-City.tar.gz.sha256.txt
289
- tar -xf GeoLite2-Country.tar.gz
290
- tar -xf GeoLite2-City.tar.gz
291
- rm GeoLite2-Country.tar.gz GeoLite2-Country.tar.gz.sha256.txt GeoLite2-City.tar.gz GeoLite2-City.tar.gz.sha256.txt
292
- cd ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
293
- chmod +x test-init.sh
294
- ./test-init.sh
295
- chmod +x run-tests.sh
296
-
297
- - name : Some DEBUG information
298
- run : |
299
- ddev --version
300
- ddev exec php -v
301
- ddev exec -s crowdsec crowdsec -version
302
-
303
- - name : Run Plugin activation tests
304
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
305
- with :
306
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
307
- file_path : 1-activate-plugin.js
308
-
309
- - name : Configure CrowdSec and Wordpress bouncer plugin
310
- run : |
311
- ddev crowdsec-config
312
-
313
- - name : Run Live mode remediation tests
314
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
315
- with :
316
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
317
- file_path : 2-live-mode-remediations.js
318
-
319
- - name : Run more Live mode remediation tests
320
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
321
- with :
322
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
323
- file_path : 3-live-mode-more.js
324
-
325
- - name : Run Live mode cache tests
326
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
327
- with :
328
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
329
- file_path : 4-live-mode-cache.js
330
-
331
- - name : Prepare cron usage
332
- run : |
333
- sed -i 's/fastcgi_finish_request/\/\/fastcgi_finish_request/g' wp-cron.php
334
-
335
- - name : Run Stream mode tests
336
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
337
- with :
338
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
339
- file_path : 5-stream-mode.js
340
-
341
- - name : Run Redis tests
342
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
343
- with :
344
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
345
- file_path : 6-redis.js
346
-
347
- - name : Run Memcached tests
348
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
349
- with :
350
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
351
- file_path : 7-memcached.js
352
-
353
- - name : Run Geolocation tests
354
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
355
- with :
356
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
357
- file_path : 8-geolocation.js
358
-
359
- - name : Run AppSec tests
360
- uses : ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
361
- with :
362
- test_path : ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
363
- file_path : 11-appsec.js
364
-
365
- - name : tmate debugging session
366
- uses : mxschmitt/action-tmate@v3
367
- with :
368
- limit-access-to-actor : true
369
- github-token : ${{ secrets.GITHUB_TOKEN }}
370
- timeout-minutes : 30
371
- if : failure()
0 commit comments