forked from Really-Simple-Plugins/complianz-gdpr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
164 lines (144 loc) · 5.4 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
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 > /dev/null 2>&1
- apt-get install git -yqq > /dev/null 2>&1
# required for "PHP 7.4+
- apt-get install libonig-dev -yqq > /dev/null 2>&1
# 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 > /dev/null 2>&1
# Install mysql driver
- docker-php-ext-install mysqli pdo_mysql mbstring > /dev/null 2>&1
# Install Xdebug. See https://xdebug.org/docs/compat for which version to install
- pecl install xdebug-${XDEBUG_VERSION} > /dev/null 2>&1
# XDEBUG mode has to be set to coverage
- echo xdebug.mode=coverage > /usr/local/etc/php/conf.d/xdebug.ini > /dev/null 2>&1
# PHP extensions
- docker-php-ext-enable mysqli pdo_mysql mbstring xdebug > /dev/null 2>&1
# Install composer
- curl -sS https://getcomposer.org/installer | php > /dev/null 2>&1
# Install all project dependencies
- php composer.phar install --ignore-platform-reqs > /dev/null 2>&1
- php composer.phar update > /dev/null 2>&1
# Set up WP test environment
- bash bin/install-wp-tests.sh wordpress_test root mysql mysql $WP_VERSION > /dev/null 2>&1
# Install WP-CLI
- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > /dev/null 2>&1
- chmod +x wp-cli.phar > /dev/null 2>&1
- mv wp-cli.phar /usr/local/bin/wp > /dev/null 2>&1
- wp core download --allow-root > /dev/null 2>&1
- wp core config --dbhost=mysql --dbname=wordpress_tests --dbuser=root --dbpass=mysql --allow-root > /dev/null 2>&1
- wp config list --allow-root > /dev/null 2>&1
- wp core install --url=http://localhost --title=Example --admin_user=supervisor --admin_password=strongpassword [email protected] --allow-root > /dev/null 2>&1
# Zip current plugin to allow it to be installed using wp-cli
- zip -r complianz-gdpr.zip . > /dev/null 2>&1
# Install the new plugin in our WP installation
- wp plugin install complianz-gdpr.zip --allow-root --force
- wp plugin activate complianz-gdpr --allow-root
- wp plugin deactivate complianz-gdpr --allow-root
- wp plugin uninstall complianz-gdpr --allow-root
# Now test an upgrade
- wp plugin install complianz-gdpr --allow-root
- wp plugin activate complianz-gdpr --allow-root
- wp plugin install complianz-gdpr.zip --allow-root --force
- wp plugin deactivate complianz-gdpr --allow-root
# WP plugin uninstall because otherwise uninstall.php won't run!
- wp plugin uninstall complianz-gdpr --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 --debug
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
# We test PHP7.4 with multisite
test:php7.4:multisite:
variables:
WP_MULTISITE: "1"
XDEBUG_VERSION: "3.1.6"
image: php:7.4
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'
# We test PHP8.0
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
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_COMMIT_BRANCH == 'master'
# We test PHP8 with multisite
test:php8.0:multisite:
variables:
WP_MULTISITE: "1"
XDEBUG_VERSION: "3.1.6"
image: php:8.0
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'
# We test PHP8.1
test:php8.1:
image: php:8.1
variables:
XDEBUG_VERSION: "3.1.6"
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.1:multisite:
variables:
WP_MULTISITE: "1"
XDEBUG_VERSION: "3.1.6"
image: php:8.1
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'
# 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'