Setting up WordPress for integration test in action fails

Hi! I’m trying to set up tests to run with my GH actions, but I’m getting

ERROR 1045 (28000): Access denied for user ‘root’@‘’ (using password: YES)

when trying to install WordPress. The workflow file is here:

name: Integration tests
runs-on: ubuntu-latest

image: mysql:5.7
 - 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

 - name: Checkout
uses: actions/checkout@v2

- name: PHP Setup
uses: shivammathur/setup-php@v2
php-version: 7.2
coverage: pcov

- name: Set Node.js version
uses: actions/setup-node@v1
node-version: 14

- name: Cache node modules
uses: actions/cache@v1
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
restore-keys: |  
 ${{ runner.OS }}-build-${{ env.cache-name }}-  
 ${{ runner.OS }}-build-  
 ${{ runner.OS }}-  
 - name: Get Composer Cache Directory
id: composer-cache
run: |  
 echo "::set-output name=dir::$(composer config cache-files-dir)"  
 - name: Cache Composer Dependencies
uses: actions/cache@v1
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |  
 ${{ runner.os }}-composer-  
 - name: Install composer packages
run: composer install --no-progress

- name: Install node packages
run: npm install

- name: Run JS build
run: npm run build

# Setup WordPress so that we can run tests  
- name: Set up WordPress instance so that we can run tests
run: |  
 cd .. && mkdir wp && cd wp  
 curl -O  
 chmod +x wp-cli.phar  
 sudo mv wp-cli.phar /usr/local/bin/wp  
 wp core download  
 wp config create --dbname=$TEST\_DB\_NAME --dbhost=$TEST\_DB\_HOST --dbuser=$TEST\_DB\_USER --dbpass=$TEST\_DB\_PASSWORD  
 wp core install --url=$TEST\_SITE\_WP\_URL --title=Test --admin\_user=$TEST\_SITE\_ADMIN\_USERNAME --admin\_password=$TEST\_SITE\_ADMIN\_PASSWORD --admin\_email=$TEST\_SITE\_ADMIN\_EMAIL  
 yes | cp .env.actions.testing .env.testing  
WP\_ROOT\_FOLDER: "/var/www/html"  
TEST\_SITE\_WP\_ADMIN\_PATH: "/wp-admin"  
TEST\_SITE\_DB\_NAME: "wordpresstest"  
TEST\_SITE\_DB\_USER: "root"  
TEST\_SITE\_DB\_PASSWORD: "password"  
TEST\_SITE\_DB\_PORT: "3306"  
TEST\_SITE\_WP\_URL: "http://wordpress.test"  
TEST\_SITE\_WP\_DOMAIN: "wordpress.test"  
TEST\_SITE\_ADMIN\_EMAIL: "admin@local.test"  
TEST\_DB\_NAME: "wordpresstest"  
TEST\_DB\_HOST: ""  
TEST\_DB\_USER: "root"  
TEST\_DB\_PASSWORD: "password"  
TEST\_DB\_PORT: "3306"  
- name: Run integration tests
run: composer test:integration

I’m trying to avoid writing a dockerfile where I’d run tests, as this seems faster an (in theory) easier.

I’m not 100% sure what I’m doing wrong, so any help is appreciated :) 

@dingo-d ,

I can reproduce the same error. I also tried some solutions like as mentioned here, but did not work.

I have reported this issue to the appropriate engineering team for further investigation and evaluation. If they have any progress, I will notify you in time, and sometimes the appropriate engineers may directly reply you here.

1 Like


In the meantime, I’ll try to play with docker solutions. It would be great to be able to just specify 2 services (MySQL and WordPress) and run the tests from those. Looking forward to it :) 

@dingo-d ,

Did you check if the passwords you are using is correct or matchs the one you set on the service?

I went with creating my own Docker image and running tests from the container. I couldn’t get this, or the image: option to work.

The tests are still not running (could be the testing lib fault) but I got the WordPress set up so that’s something :D