@@ -11,15 +11,15 @@ jobs:
1111 strategy :
1212 fail-fast : false
1313 matrix :
14- # temporary disabled for testing
15- # php: [ '7.4', '8.0', '8.1', '8.2' ]
16- # wordpress: [ '5.9', '6.0', '6.3', '6.5.3' ]
14+ # temporary disabled for testing
15+ # php: [ '7.4', '8.0', '8.1', '8.2' ]
16+ # wordpress: [ '5.9', '6.0', '6.3', '6.5.3' ]
1717 php : [ '8.4' ]
1818 wordpress : [ '6.5' ]
1919 exclude :
2020 # Exclude older PHP versions with newer WordPress
21- - php : ' 7.4'
22- wordpress : ' 6.5.3'
21+ - php : ' 7.4'
22+ wordpress : ' 6.5.3'
2323
2424 services :
2525 mysql :
@@ -43,96 +43,92 @@ jobs:
4343 WP_DB_HOST : 127.0.0.1
4444
4545 steps :
46- - name : Checkout plugin
47- uses : actions/checkout@v4
48-
49- - name : Set up PHP
50- uses : shivammathur/setup-php@v2
51- with :
52- php-version : ${{ matrix.php }}
53- extensions : mysqli, zip, gd
54- coverage : none
55- tools : wp-cli
56-
57- - name : Install dependencies
58- run : |
59- sudo apt-get update
60- sudo apt-get install -y unzip curl jq
61-
62- - name : Cache WordPress archive
63- id : cache-wordpress
64- uses : actions/cache@v3
65- with :
66- path : wordpress
67- key : wp-${{ matrix.wordpress }}-php-${{ matrix.php }}
68-
69- - name : Download WordPress
70- if : steps.cache-wordpress.outputs.cache-hit != 'true'
71- run : |
72- curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz
73- tar -xzf wordpress-${WP_VERSION}.tar.gz
74- rm wordpress-${WP_VERSION}.tar.gz
75-
76- - name : Configure WordPress
77- run : |
78- cp wordpress/wp-config-sample.php wordpress/wp-config.php
79- sed -i "s/wordpress/${WP_DB_NAME}/" wordpress/wp-config.php
80- sed -i "s/root/${WP_DB_USER}/" wordpress/wp-config.php
81- sed -i "s/root/${WP_DB_PASS}/" wordpress/wp-config.php
82- sed -i "s/localhost/${WP_DB_HOST}/" wordpress/wp-config.php
83- # Add WP_DEBUG settings
84- sed -i "/define( 'DB_COLLATE', '' );/a define( 'WP_DEBUG', true );\ndefine( 'WP_DEBUG_LOG', true );" wordpress/wp-config.php
85-
86- - name : Test config
87- run : wp config list --path=wordpress --allow-root
88-
89- - name : Install WordPress
90- run : |
91- wp core install \
92- --url="${WP_SITE_URL}" \
93- --title="Test Site" \
94- --admin_user=admin \
95- --admin_password=admin \
96- 97- --path=wordpress \
98- --skip-email \
99- --allow-root
100-
101- - name : Install plugin
102- run : |
103- PLUGIN_SLUG=$(basename "$GITHUB_WORKSPACE")
104- ln -s "$GITHUB_WORKSPACE" "wordpress/wp-content/plugins/simpleanalytics"
105- wp plugin activate simpleanalytics --path=wordpress --allow-root
106-
107- - name : Start PHP server
108- run : |
109- php -S localhost:8100 -t wordpress > /dev/null 2>&1 &
110- sleep 5
111-
112- - name : Install pnpm
113- uses : pnpm/action-setup@v4
114- with :
115- version : 10
116-
117- - name : Setup Node
118- uses : actions/setup-node@v4
119- with :
120- node-version : lts/*
121- cache : " pnpm"
122-
123- - name : Install Playwright and dependencies
124- run : |
125- pnpm install
126- pnpm run tests:install
127-
128- - name : Run Playwright tests
129- run : ./vendor/bin/pest
130-
131- - name : Upload test results
132- if : always()
133- uses : actions/upload-artifact@v4
134- with :
135- name : test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
136- path : |
137- tests/Browser/Screenshots
138- retention-days : 30
46+ - name : Checkout plugin
47+ uses : actions/checkout@v4
48+
49+ - name : Set up PHP
50+ uses : shivammathur/setup-php@v2
51+ with :
52+ php-version : ${{ matrix.php }}
53+ extensions : mysqli, zip, gd
54+ coverage : none
55+ tools : wp-cli
56+
57+ - name : Install dependencies
58+ run : |
59+ sudo apt-get update
60+ sudo apt-get install -y unzip curl jq
61+
62+ - name : Cache WordPress archive
63+ id : cache-wordpress
64+ uses : actions/cache@v3
65+ with :
66+ path : wordpress
67+ key : wp-${{ matrix.wordpress }}-php-${{ matrix.php }}
68+
69+ - name : Download WordPress
70+ if : steps.cache-wordpress.outputs.cache-hit != 'true'
71+ run : |
72+ curl -O https://wordpress.org/wordpress-${WP_VERSION}.tar.gz
73+ tar -xzf wordpress-${WP_VERSION}.tar.gz
74+ rm wordpress-${WP_VERSION}.tar.gz
75+
76+ - name : Install WordPress
77+ run : |
78+ wp config set DB_NAME "wordpress" --path=wordpress --allow-root
79+ wp config set DB_USER "root" --path=wordpress --allow-root
80+ wp config set DB_PASSWORD "root" --path=wordpress --allow-root
81+ wp config set DB_HOST "localhost" --path=wordpress --allow-root
82+ wp config set WP_DEBUG true --raw --path=wordpress --allow-root
83+ wp config set WP_DEBUG_LOG true --raw --path=wordpress --allow-root
84+ wp core install \
85+ --url="${WP_SITE_URL}" \
86+ --title="Test Site" \
87+ --admin_user=admin \
88+ --admin_password=admin \
89+ 90+ --path=wordpress \
91+ --skip-email \
92+ --allow-root
93+
94+ - name : Show current config values
95+ run : wp config list --path=wordpress --allow-root
96+
97+ - name : Install plugin
98+ run : |
99+ PLUGIN_SLUG=$(basename "$GITHUB_WORKSPACE")
100+ ln -s "$GITHUB_WORKSPACE" "wordpress/wp-content/plugins/simpleanalytics"
101+ wp plugin activate simpleanalytics --path=wordpress --allow-root
102+
103+ - name : Start PHP server
104+ run : |
105+ php -S localhost:8100 -t wordpress > /dev/null 2>&1 &
106+ sleep 5
107+
108+ - name : Install pnpm
109+ uses : pnpm/action-setup@v4
110+ with :
111+ version : 10
112+
113+ - name : Setup Node
114+ uses : actions/setup-node@v4
115+ with :
116+ node-version : lts/*
117+ cache : " pnpm"
118+
119+ - name : Install Playwright and dependencies
120+ run : |
121+ pnpm install
122+ pnpm run tests:install
123+
124+ - name : Run Playwright tests
125+ run : ./vendor/bin/pest
126+
127+ - name : Upload test results
128+ if : always()
129+ uses : actions/upload-artifact@v4
130+ with :
131+ name : test-results-php${{ matrix.php }}-wp${{ matrix.wordpress }}
132+ path : |
133+ tests/Browser/Screenshots
134+ retention-days : 30
0 commit comments