11name : End-to-end test suite
22on :
3- push :
4- branches :
5- - main
6- paths-ignore :
7- - ' **.md'
8- workflow_dispatch :
3+ push :
4+ branches :
5+ - main
6+ paths-ignore :
7+ - ' **.md'
8+ workflow_dispatch :
99
1010permissions :
11- contents : read
11+ contents : read
1212
1313jobs :
14- end-to-end-test-suite :
15- strategy :
16- fail-fast : false
17- matrix :
18- wp-version : [ "4.9", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7", "5.8", "5.9", "6.0" ]
19- php-version : [ "7.2", "7.4", "8.0" ]
20- exclude :
21- - { php-version: "7.4", wp-version: "4.9" }
22- - { php-version: "7.4", wp-version: "5.0" }
23- - { php-version: "7.4", wp-version: "5.1" }
24- - { php-version: "7.4", wp-version: "5.2" }
25- - { php-version: "8.0", wp-version: "4.9" }
26- - { php-version: "8.0", wp-version: "5.0" }
27- - { php-version: "8.0", wp-version: "5.1" }
28- - { php-version: "8.0", wp-version: "5.2" }
29- - { php-version: "8.0", wp-version: "5.3" }
30- - { php-version: "8.0", wp-version: "5.4" }
31- - { php-version: "8.0", wp-version: "5.5" }
32-
33- name : End-to-end test suite
34- runs-on : ubuntu-latest
35- if : ${{ !contains(github.event.head_commit.message, 'chore(') }}
36-
14+ end-to-end-test-suite :
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ wp-version : [ "4.9", "5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7", "5.8", "5.9", "6.0" ]
19+ php-version : [ "7.2", "7.4", "8.0" ]
20+ exclude :
21+ - { php-version: "7.4", wp-version: "4.9" }
22+ - { php-version: "7.4", wp-version: "5.0" }
23+ - { php-version: "7.4", wp-version: "5.1" }
24+ - { php-version: "7.4", wp-version: "5.2" }
25+ - { php-version: "8.0", wp-version: "4.9" }
26+ - { php-version: "8.0", wp-version: "5.0" }
27+ - { php-version: "8.0", wp-version: "5.1" }
28+ - { php-version: "8.0", wp-version: "5.2" }
29+ - { php-version: "8.0", wp-version: "5.3" }
30+ - { php-version: "8.0", wp-version: "5.4" }
31+ - { php-version: "8.0", wp-version: "5.5" }
32+
33+ name : End-to-end test suite
34+ runs-on : ubuntu-latest
35+ if : ${{ !contains(github.event.head_commit.message, 'chore(') }}
36+
37+ env :
38+ EXTENSION_NAME : " CrowdSec_Bouncer"
39+ EXTENSION_PATH : " crowdsec-bouncer"
40+
41+ steps :
42+
43+ - name : Clone DDEV files
44+ uses : actions/checkout@v2
45+ with :
46+ path : .ddev
47+ repository : julienloizelet/ddev-wp
48+
49+ - name : Install DDEV
3750 env :
38- EXTENSION_NAME : " CrowdSec_Bouncer"
39- EXTENSION_PATH : " crowdsec-bouncer"
40-
41- steps :
42-
43- - name : Clone DDEV files
44- uses : actions/checkout@v2
45- with :
46- path : .ddev
47- repository : julienloizelet/ddev-wp
48-
49- - name : Install DDEV
50- env :
51- DDEV_VERSION : v1.19.3
52- run : |
53- # @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
54- sudo apt-get -qq update
55- sudo apt-get -qq -y install libnss3-tools
56- curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh
57- bash install_ddev.sh ${{ env.DDEV_VERSION }}
58- ddev config global --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
59- rm install_ddev.sh
60-
61- - name : Set WP_VERSION_CODE env
62- # used in some directory path and conventional file naming
63- # Example : 5.6.5 => wp565
64- run : |
65- echo "WP_VERSION_CODE=$(echo wp${{ matrix.wp-version }} | sed 's/\.//g' )" >> $GITHUB_ENV
66-
67-
68- - name : Start DDEV for ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
69- run : |
70- cp .ddev/config_overrides/config.${{ env.WP_VERSION_CODE }}.yaml .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
71- cp .ddev/additional_docker_compose/docker-compose.crowdsec.yaml .ddev/docker-compose.crowdsec.yaml
72- cp .ddev/additional_docker_compose/docker-compose.playwright.yaml .ddev/docker-compose.playwright.yaml
73- sed -i -e 's/^php_version:.*/php_version: ${{ matrix.php-version }}/g' .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
74- mkdir wp-content
75- ddev start
76- sudo chmod -R 777 ${{ github.workspace }}/wp-content
77- sudo chmod -R 777 ${{ github.workspace }}/my-own-modules
78-
79- - name : Install WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
80- run : |
81- wget https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz
82- tar -xf wordpress-${{ matrix.wp-version }}.tar.gz wordpress
83- cp -r wordpress/. ${{ github.workspace }}
84- rm -rf wordpress
85- rm wordpress-${{ matrix.wp-version }}.tar.gz
86-
87- - name : Setup WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
88- run : |
89- 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'
90-
91-
92- - name : Clone ${{ env.EXTENSION_NAME }} files
93- uses : actions/checkout@v2
94- with :
95- path : my-own-modules/${{ env.EXTENSION_PATH }}
96-
97- - name : Prepare for playwright test
98- run : |
99- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
100- chmod +x test-init.sh
101- ./test-init.sh
102- chmod +x run-tests.sh
103-
104- - name : Run Plugin activation tests
105- run : |
106- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
107- ./run-tests.sh ci "./__tests__/1-activate-plugin.js"
108-
109- - name : Configure CrowdSec and Wordpress bouncer plugin
110- run : |
111- ddev crowdsec-config
112-
113- - name : Run Live mode remediation tests
114- run : |
115- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
116- ./run-tests.sh ci "./__tests__/2-live-mode-remediations.js ./__tests__/3-live-mode-more.js"
117-
118- - name : Run Live mode cache tests
119- run : |
120- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
121- ./run-tests.sh ci "./__tests__/4-live-mode-cache.js"
122-
123- - name : Prepare cron usage
124- run : |
125- sed -i 's/fastcgi_finish_request/\/\/fastcgi_finish_request/g' wp-cron.php
126-
127- - name : Run Stream mode tests
128- run : |
129- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
130- ./run-tests.sh ci "./__tests__/5-stream-mode.js"
131-
132- - name : Run Redis tests
133- run : |
134- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
135- ./run-tests.sh ci "./__tests__/6-redis.js"
136-
137- - name : Run Memcached tests
138- run : |
139- cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
140- ./run-tests.sh ci "./__tests__/7-memcached.js"
51+ DDEV_VERSION : v1.19.3
52+ run : |
53+ # @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
54+ sudo apt-get -qq update
55+ sudo apt-get -qq -y install libnss3-tools
56+ curl -LO https://raw.githubusercontent.com/drud/ddev/master/scripts/install_ddev.sh
57+ bash install_ddev.sh ${{ env.DDEV_VERSION }}
58+ ddev config global --instrumentation-opt-in=false --omit-containers=dba,ddev-ssh-agent
59+ rm install_ddev.sh
60+
61+ - name : Set WP_VERSION_CODE env
62+ # used in some directory path and conventional file naming
63+ # Example : 5.6.5 => wp565
64+ run : |
65+ echo "WP_VERSION_CODE=$(echo wp${{ matrix.wp-version }} | sed 's/\.//g' )" >> $GITHUB_ENV
66+
67+
68+ - name : Start DDEV for ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
69+ run : |
70+ cp .ddev/config_overrides/config.${{ env.WP_VERSION_CODE }}.yaml .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
71+ cp .ddev/additional_docker_compose/docker-compose.crowdsec.yaml .ddev/docker-compose.crowdsec.yaml
72+ cp .ddev/additional_docker_compose/docker-compose.playwright.yaml .ddev/docker-compose.playwright.yaml
73+ sed -i -e 's/^php_version:.*/php_version: ${{ matrix.php-version }}/g' .ddev/config.${{ env.WP_VERSION_CODE }}.yaml
74+ mkdir wp-content
75+ ddev start
76+ sudo chmod -R 777 ${{ github.workspace }}/wp-content
77+ sudo chmod -R 777 ${{ github.workspace }}/my-own-modules
78+
79+ - name : Install WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
80+ run : |
81+ wget https://wordpress.org/wordpress-${{ matrix.wp-version }}.tar.gz
82+ tar -xf wordpress-${{ matrix.wp-version }}.tar.gz wordpress
83+ cp -r wordpress/. ${{ github.workspace }}
84+ rm -rf wordpress
85+ rm wordpress-${{ matrix.wp-version }}.tar.gz
86+
87+ - name : Setup WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
88+ run : |
89+ 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'
90+
91+
92+ - name : Clone ${{ env.EXTENSION_NAME }} files
93+ uses : actions/checkout@v2
94+ with :
95+ path : my-own-modules/${{ env.EXTENSION_PATH }}
96+
97+ - name : Prepare for playwright test
98+ run : |
99+ cd ${{ github.workspace }}
100+ ddev maxmind-download DEFAULT GeoLite2-City /var/www/html/my-own-modules/${{ env.EXTENSION_PATH }}/geolocation
101+ ddev maxmind-download DEFAULT GeoLite2-Country /var/www/html/my-own-modules/${{ env.EXTENSION_PATH }}/geolocation
102+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/geolocation
103+ sha256sum -c GeoLite2-Country.tar.gz.sha256.txt
104+ sha256sum -c GeoLite2-City.tar.gz.sha256.txt
105+ tar -xf GeoLite2-Country.tar.gz
106+ tar -xf GeoLite2-City.tar.gz
107+ rm GeoLite2-Country.tar.gz GeoLite2-Country.tar.gz.sha256.txt GeoLite2-City.tar.gz GeoLite2-City.tar.gz.sha256.txt
108+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
109+ chmod +x test-init.sh
110+ ./test-init.sh
111+ chmod +x run-tests.sh
112+
113+ - name : Run Plugin activation tests
114+ run : |
115+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
116+ ./run-tests.sh ci "./__tests__/1-activate-plugin.js"
117+
118+ - name : Configure CrowdSec and Wordpress bouncer plugin
119+ run : |
120+ ddev crowdsec-config
121+
122+ - name : Run Live mode remediation tests
123+ run : |
124+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
125+ ./run-tests.sh ci "./__tests__/2-live-mode-remediations.js ./__tests__/3-live-mode-more.js"
126+
127+ - name : Run Live mode cache tests
128+ run : |
129+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
130+ ./run-tests.sh ci "./__tests__/4-live-mode-cache.js"
131+
132+ - name : Prepare cron usage
133+ run : |
134+ sed -i 's/fastcgi_finish_request/\/\/fastcgi_finish_request/g' wp-cron.php
135+
136+ - name : Run Stream mode tests
137+ run : |
138+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
139+ ./run-tests.sh ci "./__tests__/5-stream-mode.js"
140+
141+ - name : Run Redis tests
142+ run : |
143+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
144+ ./run-tests.sh ci "./__tests__/6-redis.js"
145+
146+ - name : Run Memcached tests
147+ run : |
148+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
149+ ./run-tests.sh ci "./__tests__/7-memcached.js"
150+
151+ - name : Run Geolocation tests
152+ run : |
153+ cd ${{ github.workspace }}/my-own-modules/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
154+ ./run-tests.sh ci "./__tests__/8-geolocation.js"
0 commit comments