-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
config.yml
336 lines (320 loc) · 15.4 KB
/
config.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
version: 2.1
defaults: &defaults
docker:
- image: cimg/base:stable-20.04
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
- image: circleci/mysql:8.0.23
auth:
username: mydockerhub-user
password: $DOCKERHUB_PASSWORD # context / project UI env-var reference
entrypoint:
[
"docker-entrypoint.sh",
"--default-authentication-plugin=mysql_native_password",
]
environment:
MYSQL_ROOT_PASSWORD: rootpw
MYSQL_ROOT_HOST: "%"
MYSQL_DATABASE: test_varbase
MYSQL_USER: user
MYSQL_PASSWORD: passw0rd
commands:
varbase-build:
steps:
- checkout
## Usefull must have utils.
- run:
name: Usefull must have utils
command: |
sudo apt -qq update
sudo apt install docker-buildx-plugin
sudo apt -qqy upgrade
sudo apt -yqq install vim links lynx git diffutils htop curl wget p7zip-full unzip zip sed gcc g++ make libfreetype6-dev libaio1 libaio-dev libonig-dev libpng-dev mysql-client default-mysql-client
sudo apt -yqq install xvfb libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 libnss3
## Configure and run the virtual display.
- run:
name: Configure and run the virtual display.
command: Xvfb -ac :99 -screen 0 1920x1080x24 > /dev/null 2>&1
background: true
## Setup Apache2 and PHP8.3
- run:
name: Setup Apache2 and PHP8.3
command: |
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt upgrade
sudo apt install -yqq apache2 php8.3 libapache2-mod-php8.3 php8.3-mbstring php8.3-mysql php8.3-xml php8.3-cgi php8.3-cli php8.3-common php8.3-curl php8.3-gd php8.3-imap php8.3-intl php8.3-pspell php8.3-sqlite3 php8.3-tidy php8.3-opcache php8.3-yaml php8.3-bz2 php8.3-readline php8.3-xmlrpc php8.3-enchant php8.3-xsl php8.3-zip php8.3-bcmath php-pear
sudo a2enmod php8.3
sudo a2enmod headers rewrite env mime expires ssl
sudo update-alternatives --set php /usr/bin/php8.3
echo -e "memory_limit = -1" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "max_execution_time = 1200" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "error_reporting = E_ALL" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "max_input_time = 180" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "max_input_vars = 10000" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "post_max_size = 64M" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "upload_max_filesize = 32M" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
echo -e "max_file_uploads = 40" | sudo tee /etc/php/8.3/apache2/php.ini > /dev/null
sudo service apache2 restart
## Waiting for MySQL to be ready.
- run:
name: Waiting for MySQL to be ready
command: |
for i in `seq 1 10`;
do
nc -z 127.0.0.1 3306 && echo Success && exit 0
echo -n .
sleep 1
done
echo Failed waiting for MySQL && exit 1
## Install composer ~2
- run:
name: Install composer ~2
command: |
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/ --filename=composer --2;
composer config -g github-oauth.github.com $GITHUB_TOKEN
## Install Java.
- run:
name: Install Java
command: |
sudo apt update
sudo apt install -y openjdk-11-jre openjdk-11-jre-headless openjdk-11-jdk openjdk-11-jdk-headless
## Install/Update Google Chrome browser 115.0.5790.110-1 version.
- run:
name: Install/Update Google Chrome browser 115.0.5790.110-1 version
command: |
sudo apt install libu2f-udev
sudo apt-get install libappindicator1 fonts-liberation libgbm1 libgtk-3-0 xdg-utils
export CHROME_BIN=/usr/bin/google-chrome
CHROME_VERSION="115.0.5790.110-1"
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb
sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
rm google-chrome-stable_${CHROME_VERSION}_amd64.deb
## Install/Update Chrome Driver 114.0.5735.90 version.
- run:
name: Install/Update Chrome Driver 114.0.5735.90 version
command: |
CHROME_DRIVER_VERSION=114.0.5735.90;
echo $CHROME_DRIVER_VERSION;
wget http:https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo chmod +x chromedriver
sudo mv -f chromedriver /usr/bin/
rm chromedriver_linux64.zip
## List tools versions.
- run:
name: List tools versions
command: |
php --version
java -version
google-chrome --version
chromedriver --version
mysql --version
composer --version
php -m
php -i | grep "Loaded Configuration File"
php --ini
## Build Varbase with the composer.
- run:
name: Build Varbase with the composer
command: |
if [ -d "/var/www/html/test" ]; then
sudo rm -rf /var/www/html/test -vvv
fi
cd /var/www/
sudo chmod 775 -R .
sudo chown www-data:circleci -R .
mkdir /var/www/html/test
cd /var/www/html/test/
sudo chmod 775 .
sudo chown www-data:circleci .
git clone --branch '10.0.x' https://github.com/vardot/varbase.git /var/www/html/test/varbase-code
cp -r /var/www/html/test/varbase-code /var/www/html/test/varbase
cd /var/www/html/test/varbase
composer require cweagans/composer-patches:~1 --no-update
composer require vardot/varbase-patches:~10.0.0 --no-update
composer require drupal/core-composer-scaffold:~10 --no-update
composer install --no-interaction -vvv
mkdir -p /var/www/html/test/varbase/docroot/profiles/contrib
cp -r /var/www/html/test/varbase-code /var/www/html/test/varbase/docroot/profiles/contrib/varbase
cd /var/www/html/test/varbase
sudo rm -rf config configbit css images libraries scripts src tests traslations varbase.info.yml varbase.install varbase.libraries.yml varbase.profile varbase.services.yml yarn.lock
sudo chmod 775 -R .
sudo chown www-data:circleci -R .
cp /var/www/html/test/varbase/docroot/sites/default/default.settings.php /var/www/html/test/varbase/docroot/sites/default/settings.php
echo "\$databases['default']['default'] = [
'database' => 'test_varbase',
'username' => 'root',
'password' => 'rootpw',
'host' => '127.0.0.1',
'port' => '3306',
'driver' => 'mysql',
'prefix' => '',
'collation' => 'utf8mb4_general_ci',
];" >> /var/www/html/test/varbase/docroot/sites/default/settings.php
mkdir /var/www/html/test/varbase/config
mkdir /var/www/html/test/varbase/config/sync
echo "\$settings['config_sync_directory'] = '../config/sync';" >> /var/www/html/test/varbase/docroot/sites/default/settings.php
cd /var/www/html/test/varbase
sudo chmod 775 -R .
sudo chown www-data:circleci -R .
## Point varbase.test at /var/www/html/test/varbase/docroot
- run:
name: Point varbase.test at /var/www/html/test/varbase/docroot
command: |
sudo a2enmod headers rewrite env mime expires ssl
sudo cp /home/circleci/project/.circleci/env/varbase.test.conf /etc/apache2/sites-available/varbase.test.conf
sudo a2ensite varbase.test
echo 127.0.0.1 varbase.test | sudo tee -a /etc/hosts
sudo service apache2 restart
## Install Varbase with drush.
- run:
name: Install Varbase with drush
command: |
mysql -h 127.0.0.1 -uroot -prootpw --execute="DROP DATABASE IF EXISTS test_varbase;" -vvv
mysql -h 127.0.0.1 -uroot -prootpw --execute="CREATE DATABASE test_varbase;" -vvv
cd /var/www/html/test/varbase/docroot
../bin/drush site-install varbase --yes --account-name="webmaster" --account-pass="dD.123123ddd" --account-mail="[email protected]" --db-url="mysql:https://root:[email protected]/test_varbase" --locale="en" varbase_multilingual_configuration.enable_multilingual=true varbase_extra_components.editoria11y=true varbase_extra_components.vmi=true varbase_extra_components.varbase_heroslider=true varbase_extra_components.varbase_carousels=true varbase_extra_components.varbase_search=true varbase_extra_components.varbase_blog=true varbase_extra_components.varbase_auth=true install_configure_form.enable_update_status_emails=NULL -vvv
../bin/drush pm:enable varbase_development --yes
../bin/drush pm:enable varbase_landing --yes
../bin/drush pm:enable varbase_api --yes
../bin/drush pm:enable varbase_ai --yes
../bin/drush pm:enable varbase_content_planner --yes
../bin/drush pm:enable varbase_media_instagram --yes
../bin/drush pm:enable varbase_media_twitter --yes
../bin/drush pm:enable social_auth_facebook --yes
../bin/drush pm:enable social_auth_twitter --yes
../bin/drush pm:enable social_auth_linkedin --yes
../bin/drush pm:enable varbase_update_helper --yes
../bin/drush cache:rebuild
## Set the API key and org for OpenAI.
openai_api_key="sk-change-this"
openai_api_org="org-change-this"
../bin/drush -y config:set openai.settings api_key ${openai_api_key};
../bin/drush -y config:set openai.settings api_org ${openai_api_org};
## Install/Run Selenium Standalone server 4.4.0 on 4445 port.
- run:
name: Install/Run Selenium Standalone server 4.4.0 on 4445 port
command: |
if [[ ! -f /home/circleci/selenium-server-4.4.0.jar ]]; then wget -O /home/circleci/selenium-server-4.4.0.jar https://github.com/SeleniumHQ/selenium/releases/download/selenium-4.4.0/selenium-server-4.4.0.jar; fi
cd /home/circleci/
java -jar selenium-server-4.4.0.jar standalone --port 4445
background: true
## Add testing users.
- run:
name: Add testing users.
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase/scripts
bash add-testing-users.sh
## Import and Update local RTL language
- run:
name: Import and Update local RTL language
shell: /bin/bash
command: |
cd /var/www/html/test/varbase/docroot
../bin/drush locale-import ar --autocreate-language profiles/contrib/varbase/translations/ar.po
../bin/drush locale-update --langcodes=ar
../bin/drush cr
## Uninstall Antibot module to let the selenium bot work
- run:
name: Uninstall Antibot module to let the selenium bot work
shell: /bin/bash
command: |
cd /var/www/html/test/varbase/docroot
../bin/drush pm:uninstall antibot --yes
../bin/drush config:set system.performance css.preprocess 0 --yes
../bin/drush config:set system.performance js.preprocess 0 --yes
../bin/drush config:set system.logging error_level all --yes
../bin/drush cache:rebuild
jobs:
varbase-testing-01-website-base-requirements:
<<: *defaults
steps:
- varbase-build
## Automated Functional Acceptance Testing group - 01 website base requirements
- run:
name: Automated Functional Acceptance Testing group - 01 website base requirements
no_output_timeout: 30m
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase
../../../../bin/behat tests/features/varbase/01-website-base-requirements/
varbase-testing-02-user-management:
<<: *defaults
steps:
- varbase-build
## Automated Functional Acceptance Testing group - 02 user management
- run:
name: Automated Functional Acceptance Testing group - 02 user management
no_output_timeout: 30m
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase
../../../../bin/behat tests/features/varbase/02-user-management/
varbase-testing-03-admin-management:
<<: *defaults
steps:
- varbase-build
## Automated Functional Acceptance Testing group - 03 admin management
- run:
name: Automated Functional Acceptance Testing group - 03 admin management
no_output_timeout: 30m
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase
../../../../bin/behat tests/features/varbase/03-admin-management/
varbase-testing-04-content-structure:
<<: *defaults
steps:
- varbase-build
## Automated Functional Acceptance Testing group - 04 content structure
- run:
name: Automated Functional Acceptance Testing group - 04 content structure
no_output_timeout: 30m
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase
../../../../bin/behat tests/features/varbase/04-content-structure/
varbase-testing-05-content-management:
<<: *defaults
steps:
- varbase-build
## Automated Functional Acceptance Testing group - 05 content-management
- run:
name: Automated Functional Acceptance Testing group - 05 content-management
no_output_timeout: 30m
command: |
cd /var/www/html/test/varbase/docroot/profiles/contrib/varbase
../../../../bin/behat tests/features/varbase/05-content-management/
workflows:
version: 2
varbase-workflow:
jobs:
- varbase-testing-01-website-base-requirements:
filters:
tags:
only: /^10.0.*/
branches:
only: /^10.0.x/
- varbase-testing-02-user-management:
filters:
tags:
only: /^10.0.*/
branches:
only: /^10.0.x/
- varbase-testing-03-admin-management:
filters:
tags:
only: /^10.0.*/
branches:
only: /^10.0.x/
- varbase-testing-04-content-structure:
filters:
tags:
only: /^10.0.*/
branches:
only: /^10.0.x/
- varbase-testing-05-content-management:
filters:
tags:
only: /^10.0.*/
branches:
only: /^10.0.x/