Gitlab 中的 Wordpress CI

Wordpress CI in Gitlab

是否有使用 Gitlab CI 实现 WorPress (WP_UnitTestCase) 的任何参考资料?

我已经尝试配置 .gitlab-ci.yml,它实现了构建,但没有运行测试。

这是 .gitlab-ci.yml 文件:

image: php:5.6

variables:
  # Configure mysql service (https://hub.docker.com/_/mysql/)
  MYSQL_DATABASE: wordpress_tests
  MYSQL_ROOT_PASSWORD: mysql

before_script:
  # Install dependencies
  - bash ci/docker_install.sh wordpress_tests root mysql tutum-wordpress latest

stages:
  - test

# test:PHP5.3:MySQL:
#   image: tetraweb/php:5.3
#   script:
#   - phpunit --configuration phpunit.xml.dist

test:PHP5.4:MySQL:
  image: tetraweb/php:5.4
  services:
  - tutum/wordpress:latest
  script:
  - phpunit --configuration phpunit.xml.dist

# test:PHP5.6:MySQL:
#   image: php:5.6
#   script:
#   - phpunit --configuration phpunit.xml.dist

# test:PHP7:MySQL:
#   image: php:7
#   script:
#   - phpunit --configuration phpunit.xml.dist

经过大量的试验和错误后我让它为我工作,你可以看到 PHP5.3 到 PHP7.0 的测试是 运行 正确的测试我创建的插件 here

我的.gitlab-ci.yml looks like. and the shell script to setup the environment is here

就是这样

要在您的项目中使用它,只需将 .gitlab-ci.ymlbin/install_gitlab_tests.sh 复制到您的项目中。

我遇到了类似的问题。看起来这是 phpunit 6.0 的 wordpress 兼容性问题。通过将 phpunit 降级到 5.6 来修复。参见:https://github.com/wp-cli/wp-cli/issues/3802