.gitlab-ci.yml 1.99 KB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
1
2
3
4
5
variables:
  # Configure mysql service (https://hub.docker.com/_/mysql/)
  MYSQL_DATABASE: wordpress_tests
  MYSQL_ROOT_PASSWORD: mysql

Erick Hitter's avatar
Cleanup    
Erick Hitter committed
6
7
8
9
cache:
  paths:
    - $HOME/.composer

Erick Hitter's avatar
Erick Hitter committed
10
11
12
13
14
15
16
before_script:
  # Install dependencies

  # update the docker
  - apt-get clean
  - apt-get -yqq update

Erick Hitter's avatar
Erick Hitter committed
17
  # install the required packages for the running CI tests
Erick Hitter's avatar
Erick Hitter committed
18
  - |
Erick Hitter's avatar
Deps    
Erick Hitter committed
19
    apt-get -yqqf install lsb-release zip unzip subversion mysql-client libicu-dev libpng-dev libbz2-dev --fix-missing
Erick Hitter's avatar
Debug    
Erick Hitter committed
20

Erick Hitter's avatar
Typo    
Erick Hitter committed
21
    if [[ $(lsb_release -a) =~ "stretch" ]]; then
Erick Hitter's avatar
Erick Hitter committed
22
23
24
25
      apt-get -yqqf install default-libmysqlclient-dev --fix-missing
    else
      apt-get -yqqf install libmysqlclient-dev --fix-missing
    fi
Erick Hitter's avatar
Erick Hitter committed
26
27

  # PHP extensions
Erick Hitter's avatar
Debug    
Erick Hitter committed
28
  - docker-php-ext-install mbstring mysqli intl gd zip bz2
Erick Hitter's avatar
Erick Hitter committed
29

30
31
  # Install Composer
  - curl -sS https://getcomposer.org/installer | php
Erick Hitter's avatar
Erick Hitter committed
32
33
  - mv composer.phar /usr/local/bin/composer
  - export PATH="$HOME/.composer/vendor/bin:$PATH"
34

Erick Hitter's avatar
Erick Hitter committed
35
  # Set up WordPress tests
Erick Hitter's avatar
Erick Hitter committed
36
  - bash bin/install-wp-tests.sh $MYSQL_DATABASE root $MYSQL_ROOT_PASSWORD mysql latest true
Erick Hitter's avatar
Erick Hitter committed
37

Erick Hitter's avatar
Erick Hitter committed
38
39
  # PHPUnit
  - |
Erick Hitter's avatar
Debug    
Erick Hitter committed
40
    if [[ $(php -v) =~ "PHP 7." ]]; then
Erick Hitter's avatar
Erick Hitter committed
41
      composer global require "phpunit/phpunit=6.1.*"
Erick Hitter's avatar
Erick Hitter committed
42
    else
Erick Hitter's avatar
Erick Hitter committed
43
      composer global require "phpunit/phpunit=4.8.*"
Erick Hitter's avatar
Erick Hitter committed
44
    fi
Erick Hitter's avatar
Erick Hitter committed
45

Erick Hitter's avatar
Erick Hitter committed
46
  # Install PHPCS and WPCS
Erick Hitter's avatar
Erick Hitter committed
47
  - composer global require automattic/vipwpcs
Erick Hitter's avatar
Erick Hitter committed
48
49
50
51
52
53
54
  - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs,$HOME/.composer/vendor/automattic/vipwpcs

PHPunit:PHP5.3:MySQL:
  image: tetraweb/php:5.3
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
55
    - phpcs -n
56
    - phpunit
57
  when: manual
Erick Hitter's avatar
Erick Hitter committed
58
  allow_failure: true
Erick Hitter's avatar
Erick Hitter committed
59
60

PHPunit:PHP5.6:MySQL:
Erick Hitter's avatar
Erick Hitter committed
61
  image: php:5.6-stretch
Erick Hitter's avatar
Erick Hitter committed
62
63
64
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
65
    - phpcs -n
66
    - phpunit
Erick Hitter's avatar
Erick Hitter committed
67
68

PHPunit:PHP7.0:MySQL:
Erick Hitter's avatar
Erick Hitter committed
69
  image: php:7.0-stretch
Erick Hitter's avatar
Erick Hitter committed
70
71
72
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
73
    - phpcs -n
74
    - phpunit
Erick Hitter's avatar
Erick Hitter committed
75
76

PHPunit:PHP7.1:MySQL:
Erick Hitter's avatar
Erick Hitter committed
77
  image: php:7.1-stretch
Erick Hitter's avatar
Erick Hitter committed
78
79
80
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
81
    - phpcs -n
82
    - phpunit
Erick Hitter's avatar
Erick Hitter committed
83
84

PHPunit:PHP7.2:MySQL:
Erick Hitter's avatar
Erick Hitter committed
85
  image: php:7.2-stretch
Erick Hitter's avatar
Erick Hitter committed
86
87
88
  services:
    - mysql:5.6
  script:
Erick Hitter's avatar
Erick Hitter committed
89
    - phpcs -n
90
    - phpunit