@@ -141,7 +141,6 @@ jobs:
141141 if : github.event.inputs.deploy_to_wordpress == 'true'
142142 uses : softprops/action-gh-release@v1
143143 with :
144- token : ${{ secrets.CS_RELEASE_TOKEN }}
145144 files : crowdsec.zip
146145 body_path : CHANGELOG.txt
147146 name : ${{ env.VERSION_NUMBER }}
@@ -158,3 +157,177 @@ jobs:
158157 tag_name : ${{ github.event.inputs.tag_name }}
159158 draft : false
160159 prerelease : false
160+
161+ end-to-end-release-zip-test :
162+ strategy :
163+ fail-fast : false
164+ matrix :
165+ wp-version : [ "4.9", "5.1", "5.3", "5.5", "5.7", "5.9", "6.1" ]
166+ php-version : [ "7.2", "7.4", "8.0" ]
167+ exclude :
168+ - { php-version: "7.4", wp-version: "4.9" }
169+ - { php-version: "7.4", wp-version: "5.1" }
170+ - { php-version: "8.0", wp-version: "4.9" }
171+ - { php-version: "8.0", wp-version: "5.1" }
172+ - { php-version: "8.0", wp-version: "5.3" }
173+ - { php-version: "8.0", wp-version: "5.5" }
174+
175+ name : End-to-end release test suite
176+ runs-on : ubuntu-latest
177+ if : success()
178+ needs : [ deploy-create-release ]
179+
180+ env :
181+ EXTENSION_NAME : " CrowdSec_Bouncer"
182+ EXTENSION_PATH : " crowdsec-bouncer"
183+
184+ steps :
185+
186+ - name : Clone DDEV files
187+ uses : actions/checkout@v3
188+ with :
189+ path : .ddev
190+ repository : julienloizelet/ddev-wp
191+
192+ - name : Install DDEV
193+ env :
194+ DDEV_VERSION : v1.21.4
195+ run : |
196+ # @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
197+ sudo apt-get -qq update
198+ sudo apt-get -qq -y install libnss3-tools
199+ curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh
200+ bash install_ddev.sh ${{ env.DDEV_VERSION }}
201+ ddev config global --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
202+ rm install_ddev.sh
203+
204+ - name : Set WP_VERSION_CODE env
205+ # used in some directory path and conventional file naming
206+ # Example : 5.6.5 => wp565
207+ run : |
208+ echo "WP_VERSION_CODE=$(echo wp${{ matrix.wp-version }} | sed 's/\.//g' )" >> $GITHUB_ENV
209+
210+ - name : Start DDEV for ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
211+ run : |
212+ cp .ddev/config_overrides/config.${{ env.WP_VERSION_CODE }}.yaml .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
213+ cp .ddev/additional_docker_compose/docker-compose.crowdsec-without-plugin.yaml .ddev/docker-compose.crowdsec.yaml
214+ cp .ddev/additional_docker_compose/docker-compose.playwright.yaml .ddev/docker-compose.playwright.yaml
215+ sed -i -e 's/^php_version:.*/php_version: ${{ matrix.php-version }}/g' .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
216+ mkdir -p wp-content/plugins
217+ mkdir -p my-own-modules/${{ env.EXTENSION_PATH }}
218+ ddev start
219+ sudo chmod -R 777 ${{ github.workspace }}/wp-content
220+ sudo chmod -R 777 ${{ github.workspace }}/my-own-modules
221+
222+ - name : Some DEBUG information
223+ run : |
224+ ddev --version
225+ ddev exec php -v
226+ ddev exec -s crowdsec crowdsec -version
227+
228+ - name : Install WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
229+ run : |
230+ wget https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz
231+ tar -xf wordpress-${{ matrix.wp-version }}.tar.gz wordpress
232+ cp -r wordpress/. ${{ github.workspace }}
233+ rm -rf wordpress
234+ rm wordpress-${{ matrix.wp-version }}.tar.gz
235+
236+ - name : Setup WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
237+ run : |
238+ ddev exec wp core install --url='https://${{ env.WP_VERSION_CODE }}.ddev.site' --title='WordPress' --admin_user='admin' --admin_password='admin123' --admin_email='admin@admin.com'
239+
240+ - name : Clone ${{ env.EXTENSION_NAME }} files
241+ uses : actions/checkout@v3
242+ with :
243+ path : my-own-modules/${{ env.EXTENSION_PATH }}
244+
245+ - name : Retrieve last stable release zip
246+ run : |
247+ LAST_TAG=$(curl -Ls -o /dev/null -w %{url_effective} $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/latest | grep -oP "\/tag\/v\K(.*)$")
248+ curl -fL https://downloads.wordpress.org/plugin/crowdsec.$LAST_TAG.zip -o crowdsec.$LAST_TAG.zip
249+ unzip crowdsec.$LAST_TAG.zip -d ${{ github.workspace }}/wp-content/plugins
250+
251+ - name : Prepare for playwright test
252+ run : |
253+ cd ${{ github.workspace }}
254+ cp .ddev/custom_files/crowdsec/php/cache-actions-from-plugin-folder.php cache-actions.php
255+ cp -r .ddev/custom_files/crowdsec/cfssl/* wp-content/plugins/crowdsec/tls
256+ cd wp-content/plugins/crowdsec
257+ docker cp "tls" ddev-${{ env.WP_VERSION_CODE }}-playwright://var/www/html/wp-content/plugins/crowdsec
258+ ddev maxmind-download DEFAULT GeoLite2-City /var/www/html/wp-content/plugins/crowdsec/geolocation
259+ ddev maxmind-download DEFAULT GeoLite2-Country /var/www/html/wp-content/plugins/crowdsec/geolocation
260+ cd ${{ github.workspace }}/wp-content/plugins/crowdsec/geolocation
261+ sha256sum -c GeoLite2-Country.tar.gz.sha256.txt
262+ sha256sum -c GeoLite2-City.tar.gz.sha256.txt
263+ tar -xf GeoLite2-Country.tar.gz
264+ tar -xf GeoLite2-City.tar.gz
265+ rm GeoLite2-Country.tar.gz GeoLite2-Country.tar.gz.sha256.txt GeoLite2-City.tar.gz GeoLite2-City.tar.gz.sha256.txt
266+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
267+ chmod +x test-init.sh
268+ ./test-init.sh
269+ chmod +x run-tests.sh
270+
271+ - name : Run Plugin activation tests
272+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
273+ with :
274+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
275+ file_path : 1-activate-plugin.js
276+
277+ - name : Configure CrowdSec and Wordpress bouncer plugin
278+ run : |
279+ ddev crowdsec-config
280+
281+ - name : Run Live mode remediation tests
282+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
283+ with :
284+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
285+ file_path : 2-live-mode-remediations.js
286+
287+ - name : Run more Live mode remediation tests
288+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
289+ with :
290+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
291+ file_path : 3-live-mode-more.js
292+
293+ - name : Run Live mode cache tests
294+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
295+ with :
296+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
297+ file_path : 4-live-mode-cache.js
298+
299+ - name : Prepare cron usage
300+ run : |
301+ sed -i 's/fastcgi_finish_request/\/\/fastcgi_finish_request/g' wp-cron.php
302+
303+ - name : Run Stream mode tests
304+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
305+ with :
306+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
307+ file_path : 5-stream-mode.js
308+
309+ - name : Run Redis tests
310+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
311+ with :
312+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
313+ file_path : 6-redis.js
314+
315+ - name : Run Memcached tests
316+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
317+ with :
318+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
319+ file_path : 7-memcached.js
320+
321+ - name : Run Geolocation tests
322+ uses : ./my-own-modules/crowdsec-bouncer/.github/workflows/end-to-end/run-single-test
323+ with :
324+ test_path : ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
325+ file_path : 8-geolocation.js
326+
327+ - name : tmate debugging session
328+ uses : mxschmitt/action-tmate@v3
329+ with :
330+ limit-access-to-actor : true
331+ github-token : ${{ secrets.GITHUB_TOKEN }}
332+ timeout-minutes : 30
333+ if : failure()
0 commit comments