[solved]Gitlab CI tests for WordPress

WP-Cli, a command line interface for WordPress has a simple command to get started with Travis CI unit testing for any WordPress development projects.

In an issue on WP-Cli project, the team is going to add in a command that will automate default WordPress tesing on Gitlab Ci.

I have been already trying to set-up Gitlab CI for my WordPress projects, but not yet successful with it.

Has anyone had any success with setting up WordPress tests on Gitlab CI?

~ Nik

I have set up an existing project from Github to gitlab.com for setting up the unit testing, I have also set up a specific runner for the project.

Project can be found here, and it’s builds here

The project does not have any actual PHP unit test cases, I am just trying to set up the CI environment as of yet.

If you see the same commits are failing on Gitlab CI but are passing on Travis CI,

Travis CI build which is passing and Gitlab CI build which is failing for same commit.

Any info on this would be helpful.

Hi @Nik sorry for the late reply. I’m gonna try to get to the bottom of this as there is a blog post coming about testing PHP apps. I may be able to have it sorted out this week.

Thank you @axil, Please let me know if there is any more info needed from my side for this, whether it may be testing .gitlab-ci.yml.

An update on this, I looked through core WordPress source code on the failing files, and saw that hey are using mysqli So I installed mysqli docker extension, the builds are not "failing" but the there are errors, It is not able to connect to mysql database.

@axil: I did figure out what was wrong with my configuration, I was using wrong host this time. This issue is resolved now.

Thank you :smile:

2 Likes

@Nik I have checked you test-wp-plugin code, the run is made, but no test is verified, can you help me on that?