1010 fail-fast : false
1111 matrix :
1212 php : ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
13- runs-on : ubuntu-latest
13+ runs-on : ubuntu-20.04
1414
1515 steps :
1616 - name : Check out source code
@@ -58,35 +58,46 @@ jobs:
5858 run : composer phpunit
5959
6060 functional : # ----------------------------------------------------------------------
61- name : Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
61+ name : Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
6262 strategy :
6363 fail-fast : false
6464 matrix :
65- php : ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
65+ php : ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0' ]
6666 wp : ['latest']
67- test : ["composer behat || composer behat-rerun" ]
67+ mysql : ['8.0' ]
6868 include :
6969 - php : ' 5.6'
7070 wp : ' trunk'
71- test : " composer behat || composer behat-rerun"
71+ mysql : ' 8.0'
72+ - php : ' 5.6'
73+ wp : ' trunk'
74+ mysql : ' 5.7'
75+ - php : ' 5.6'
76+ wp : ' trunk'
77+ mysql : ' 5.6'
7278 - php : ' 7.4'
7379 wp : ' trunk'
74- test : " composer behat || composer behat-rerun"
80+ mysql : ' 8.0'
81+ - php : ' 8.0'
82+ wp : ' trunk'
83+ mysql : ' 8.0'
84+ - php : ' 8.0'
85+ wp : ' trunk'
86+ mysql : ' 5.7'
87+ - php : ' 8.0'
88+ wp : ' trunk'
89+ mysql : ' 5.6'
7590 - php : ' 5.6'
7691 wp : ' 3.7'
77- test : " composer behat || composer behat-rerun || true "
78- runs-on : ubuntu-latest
92+ mysql : ' 5.6 '
93+ runs-on : ubuntu-20.04
7994
8095 services :
8196 mysql :
82- image : mysql:5.7
83- env :
84- MYSQL_DATABASE : wp_cli_test
85- MYSQL_USER : root
86- MYSQL_ROOT_PASSWORD : root
97+ image : mysql:${{ matrix.mysql }}
8798 ports :
8899 - 3306
89- options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
100+ options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
90101
91102 steps :
92103 - name : Check out source code
@@ -99,10 +110,11 @@ jobs:
99110 files : " composer.json, behat.yml"
100111
101112 - name : Set up PHP envirnoment
113+ if : steps.check_files.outputs.files_exists == 'true'
102114 uses : shivammathur/setup-php@v2
103115 with :
104116 php-version : ' ${{ matrix.php }}'
105- extensions : mysql, zip, imagick
117+ extensions : imagick, mysql, zip
106118 coverage : none
107119 tools : composer
108120
@@ -121,29 +133,35 @@ jobs:
121133 restore-keys : |
122134 ${{ runner.os }}-composer-
123135
124- - name : Change ImageMagick policy to allow pdf->png conversion.
125- run : |
126- sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
127-
128136 - name : Install dependencies
129137 if : steps.check_files.outputs.files_exists == 'true'
130138 run : COMPOSER_ROOT_VERSION=dev-master composer install --prefer-dist --no-progress --no-suggest
131139
132140 - name : Start MySQL server
133141 if : steps.check_files.outputs.files_exists == 'true'
134- run : sudo service mysql start
142+ run : sudo systemctl start mysql
135143
136- - name : Prepare test database
144+ - name : Configure DB environment
137145 if : steps.check_files.outputs.files_exists == 'true'
138146 run : |
139- export MYQSL_HOST =127.0.0.1
147+ export MYSQL_HOST =127.0.0.1
140148 export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
141- mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
142- mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
143- mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
149+ echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
150+ echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
151+ echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
152+ echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
153+ echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
154+
155+ - name : Prepare test database
156+ if : steps.check_files.outputs.files_exists == 'true'
157+ run : composer prepare-tests
158+
159+ - name : Check Behat environment
160+ if : steps.check_files.outputs.files_exists == 'true'
161+ run : WP_CLI_TEST_DEBUG_BEHAT_ENV=1 composer behat
144162
145163 - name : Run Behat
146164 if : steps.check_files.outputs.files_exists == 'true'
147165 env :
148166 WP_VERSION : ' ${{ matrix.wp }}'
149- run : ${{ matrix.test }}
167+ run : composer behat || composer behat-rerun
0 commit comments