-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
119 lines (102 loc) · 3.88 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
stages:
- test
# Select what we should cache
cache:
paths:
- vendor/
services:
- mysql
# before_script will run on ALL PHP versions listed in test
before_script:
# Install git, the php image doesn't have it installed
- apt-get update -yqq
- apt-get install git -yqq
# required for "PHP 7.4+
- apt-get install libonig-dev -yqq
# install the required packages for the running CI tests
- apt-get -yqqf install wget zip unzip subversion default-mysql-client libmcrypt-dev default-libmysqlclient-dev default-mysql-server --fix-missing
# Install mysql driver
- docker-php-ext-install mysqli pdo_mysql mbstring
# Install Xdebug. See https://xdebug.org/docs/compat for which version to install
- pecl install xdebug-${XDEBUG_VERSION}
# XDEBUG mode has to be set to coverage
- echo xdebug.mode=coverage > /usr/local/etc/php/conf.d/xdebug.ini
# PHP extensions
- docker-php-ext-enable mysqli pdo_mysql mbstring xdebug
# Install composer
- curl -sS https://getcomposer.org/installer | php
# Install all project dependencies
- php composer.phar install --ignore-platform-reqs
- php composer.phar update
# Set up WP test environment
- bash bin/install-wp-tests.sh wordpress_test root mysql mysql $WP_VERSION
# Install WP-CLI
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- chmod +x wp-cli.phar
- mv wp-cli.phar /usr/local/bin/wp
- wp core download --allow-root
- wp core config --dbhost=mysql --dbname=wordpress_tests --dbuser=root --dbpass=mysql --allow-root
- wp config list --allow-root
- wp core install --url=http://localhost --title=Example --admin_user=supervisor --admin_password=strongpassword [email protected] --allow-root
# Zip current plugin to allow it to be installed using wp-cli
- zip -r complianz-terms-conditions.zip .
# Install the new plugin in our WP installation
- wp plugin install complianz-terms-conditions.zip --allow-root --force
- wp plugin activate complianz-terms-conditions --allow-root
- wp plugin deactivate complianz-terms-conditions --allow-root
- wp plugin uninstall complianz-terms-conditions --allow-root
# Now test an upgrade
- wp plugin install complianz-terms-conditions --allow-root
- wp plugin activate complianz-terms-conditions --allow-root
- wp plugin install complianz-terms-conditions.zip --allow-root --force
- wp plugin deactivate complianz-terms-conditions --allow-root
# WP plugin uninstall because otherwise uninstall.php won't run!
- wp plugin uninstall complianz-terms-conditions --allow-root
variables:
# Configure mysql service (https://hub.docker.com/_/mysql/)
MYSQL_DATABASE: wordpress_tests
MYSQL_ROOT_PASSWORD: mysql
WP_VERSION: latest
WP_MULTISITE: "0"
# We test PHP 7.4
test:php7.4:
image: php:7.4
variables:
XDEBUG_VERSION: "3.1.6"
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clove --colors=never
# We test PHP8
test:php8.0:
image: php:8.0
variables:
XDEBUG_VERSION: "3.1.6"
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --colors=never
# We test PHP8.1
test:php8.1:
image: php:8.1
variables:
XDEBUG_VERSION: "3.2.1"
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --colors=never
# We test PHP8.1
test:php8.2:
image: php:8.2
variables:
XDEBUG_VERSION: "3.2.1"
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --colors=never
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
# We test PHP8.1 with multisite
test:php8.2:multisite:
variables:
WP_MULTISITE: "1"
XDEBUG_VERSION: "3.2.1"
image: php:8.2
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clove --colors=never
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'