Skip to content

Commit 7593495

Browse files
author
David Ferlay
authored
Merge branch 'master' into composer_prestissimo
2 parents 715d2cf + b526241 commit 7593495

File tree

12 files changed

+194
-355
lines changed

12 files changed

+194
-355
lines changed

.env.default

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ IMAGE_SOLR=solr:8-slim
1717
IMAGE_REDIS=redis:5-alpine
1818
IMAGE_DRIVER=zenika/alpine-chrome
1919
CLEAR_FRONT_PACKAGES=no
20-
ADD_PHP_EXT=
20+
ADD_PHP_EXT=graphicsmagick
21+
#ADD_PHP_EXT=php7-pdo_pgsql postgresql-client postgresql-contrib gnu-libiconv wkhtmltopdf
2122
MAIN_DOMAIN_NAME=docker.localhost
2223
DB_URL=sqlite:./../.cache/d8.sqlite
2324
# Faster but data will be lost on php container recreation
2425
#DB_URL=sqlite:///dev/shm/d8.sqlite
2526
#DB_URL=mysql://d8:d8@mysql/d8
27+
#DB_URL=pgsql://d9:d9root@postgresql/d9
2628
# Include path to this folder to your .gitignore if you override it
2729
DB_DATA_DIR=../.cache
2830
#DB_DATA_DIR=/dev/shm

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ docker/docker-compose.override.yml
1717
behat.yml
1818
features/*.html
1919
features/*.png
20+
features/junit/
2021
.cache/
2122
.editorconfig
2223
.gitattributes

.gitlab-ci.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Variables to add in Gitalb UI : Settings > CI/CD
22
# - SONAR_HOST // Optional
33
# - SONAR_TOKEN // Optional
4+
# - NEW_RELIC_LICENSE_KEY // Optional
45

56
variables:
6-
GIT_DEPTH: "3"
7+
GIT_DEPTH: "10"
78
THEME_PATH: "" # Update to enable front jobs (web/themes/custom/XXX)
89
STORYBOOK_PATH: "" # Update to enable storybook job (themes/custom/XXX/dist/storybook/index.html)
9-
GIT_STRATEGY: clone # Workaround until git is updated in runner, see https://gitlab.com/gitlab-org/gitlab-foss/issues/60466
10+
GIT_STRATEGY: fetch
1011
REVIEW_DOMAIN: "XXX.XXX.com" # Mandatory, should equal to DNS of available runner server with docker + docker-compose + traefik
1112

1213
image: skilldlabs/php:73
@@ -33,6 +34,7 @@ stages:
3334
- sniffers
3435
- prepare
3536
- deploy
37+
- storybook
3638
- tests
3739
- reports
3840

@@ -179,7 +181,7 @@ prepare:front:
179181
- echo "CI_PROJECT_NAME=${CI_PROJECT_NAME}"
180182
- echo "REVIEW_DOMAIN=${REVIEW_DOMAIN}"
181183
- mkdir -p ${BUILD_DIR}
182-
- rsync -ah --exclude=.git --delete ./ ${BUILD_DIR}
184+
- rsync -ah --exclude=.git --exclude=.cache --delete ./ ${BUILD_DIR}
183185
- cd ${BUILD_DIR}
184186
- echo "COMPOSE_PROJECT_NAME=${CI_PROJECT_NAME}-review-${CI_COMMIT_REF_SLUG}" >> .env.default
185187
- echo "MAIN_DOMAIN_NAME=${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}" >> .env.default
@@ -196,7 +198,6 @@ prepare:front:
196198
dependencies:
197199
- prepare:back
198200
- prepare:front
199-
allow_failure: false
200201
<<: *runner_tag_selection
201202
<<: *only_branches
202203

@@ -230,7 +231,7 @@ stop_review:
230231
<<: *only_branches
231232

232233
deploy:storybook:
233-
stage: deploy
234+
stage: storybook
234235
environment:
235236
url: https://${CI_ENVIRONMENT_SLUG}-${CI_PROJECT_PATH_SLUG}.${REVIEW_DOMAIN}
236237
name: review/$CI_COMMIT_REF_NAME
@@ -245,8 +246,6 @@ deploy:storybook:
245246
<<: *runner_tag_selection
246247
<<: *only_branches
247248
<<: *only_var_theme
248-
when: always
249-
250249

251250
test:behat:
252251
stage: tests
@@ -257,22 +256,29 @@ test:behat:
257256
script:
258257
- echo "Starting job script in ${BUILD_DIR}"
259258
- cd ${BUILD_DIR}
260-
- make behat
259+
- BEHAT_ARGS='--colors -f pretty -o std -f junit -o features/junit' make behat
261260
after_script:
262261
- cd ${BUILD_DIR}
263262
- make browser_driver_stop
264263
- rm -rf web/screenshots
265264
- mkdir web/screenshots
266265
- mv features/*.png web/screenshots/
267266
- echo "- Screenshots are available here :" && cd web/screenshots && ls -h *.png | xargs -i echo "${CI_ENVIRONMENT_URL}/screenshots/{}"
267+
- mv ${BUILD_DIR}/features/junit ${CI_PROJECT_DIR}
268268
retry:
269269
max: 2
270270
when: script_failure
271271
dependencies:
272272
- deploy:review
273-
allow_failure: false
274273
<<: *runner_tag_selection
275274
<<: *only_branches
275+
artifacts:
276+
expire_in: 1 week
277+
when: always
278+
paths:
279+
- junit/*.xml
280+
reports:
281+
junit: junit/*.xml
276282

277283
test:cinsp:
278284
stage: tests

Makefile

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ CGID ?= $(LOCAL_GID)
2424
# Define network name.
2525
COMPOSE_NET_NAME := $(COMPOSE_PROJECT_NAME)_front
2626

27-
# Determine mysql data directory if defined
28-
ifeq ($(shell docker-compose config --services | grep mysql),mysql)
29-
MYSQL_DIR=$(shell cd docker && realpath $(DB_DATA_DIR))/$(COMPOSE_PROJECT_NAME)_mysql
27+
SDC_SERVICES=$(shell docker-compose config --services)
28+
# Determine database data directory if defined
29+
ifeq ($(findstring mysql,$(SDC_SERVICES)),mysql)
30+
DB_MOUNT_DIR=$(shell cd docker && realpath $(DB_DATA_DIR))/$(COMPOSE_PROJECT_NAME)_mysql
31+
endif
32+
ifeq ($(findstring postgresql,$(SDC_SERVICES)),postgresql)
33+
DB_MOUNT_DIR=$(shell cd docker && realpath $(DB_DATA_DIR))/$(COMPOSE_PROJECT_NAME)_pgsql
3034
endif
3135

3236
# Define current directory only once
@@ -59,22 +63,30 @@ ifeq ($(strip $(COMPOSE_PROJECT_NAME)),projectname)
5963
$(info Please review your project settings and run `make all` again.)
6064
exit 1
6165
endif
62-
ifdef MYSQL_DIR
63-
mkdir -p $(MYSQL_DIR) && chmod 777 $(MYSQL_DIR)
66+
ifdef DB_MOUNT_DIR
67+
$(shell [ ! -d $(DB_MOUNT_DIR) ] && mkdir -p $(DB_MOUNT_DIR) && chmod 777 $(DB_MOUNT_DIR))
6468
endif
6569
make -s down
6670
@echo "Updating containers..."
6771
docker-compose pull
6872
@echo "Build and run containers..."
6973
docker-compose up -d --remove-orphans
70-
$(call php-0, apk add --no-cache graphicsmagick $(ADD_PHP_EXT))
74+
$(call php-0, apk add --no-cache tzdata $(ADD_PHP_EXT))
75+
# Set up timezone
76+
$(call php-0, cp /usr/share/zoneinfo/Europe/Paris /etc/localtime)
77+
# Install newrelic PHP extension if NEW_RELIC_LICENSE_KEY defined
78+
make -s newrelic
7179
$(call php-0, kill -USR2 1)
7280
$(call php, composer global require -o --update-no-dev --no-suggest "hirak/prestissimo:^0.3")
7381

7482
## Install backend dependencies
7583
back:
76-
docker-compose up -d --remove-orphans php # PHP container is required for composer
84+
docker-compose up -d --remove-orphans --no-deps php # PHP container is required for composer
7785
$(call php, composer global require -o --update-no-dev --no-suggest "hirak/prestissimo:^0.3")
86+
ifneq ($(strip $(ADD_PHP_EXT)),)
87+
# Install additional php extensions as this goal used in CI (todo stop doing it)
88+
$(call php-0, apk add --no-cache $(ADD_PHP_EXT))
89+
endif
7890
ifeq ($(INSTALL_DEV_DEPENDENCIES), TRUE)
7991
@echo "INSTALL_DEV_DEPENDENCIES=$(INSTALL_DEV_DEPENDENCIES)"
8092
@echo "Installing composer dependencies, including dev ones"
@@ -143,9 +155,9 @@ clean: info
143155
make -s down
144156
$(eval SCAFFOLD = $(shell docker run --rm -v $(CURDIR):/mnt -w /mnt --user $(CUID):$(CGID) $(IMAGE_PHP) composer run-script list-scaffold-files | grep -P '^(?!>)'))
145157
@docker run --rm --user 0:0 -v $(CURDIR):/mnt -w /mnt -e RMLIST="$(addprefix web/,$(SCAFFOLD)) $(DIRS)" $(IMAGE_PHP) sh -c 'for i in $$RMLIST; do rm -fr $$i && echo "Removed $$i"; done'
146-
ifdef MYSQL_DIR
147-
@echo "Removing mysql data from $(MYSQL_DIR) ..."
148-
docker run --rm --user 0:0 -v $(shell dirname $(MYSQL_DIR)):/mnt $(IMAGE_PHP) sh -c "rm -fr /mnt/`basename $(MYSQL_DIR)`"
158+
ifdef DB_MOUNT_DIR
159+
@echo "Clean-up database data from $(DB_MOUNT_DIR) ..."
160+
docker run --rm --user 0:0 -v $(shell dirname $(DB_MOUNT_DIR)):/mnt $(IMAGE_PHP) sh -c "rm -fr /mnt/`basename $(DB_MOUNT_DIR)`"
149161
endif
150162
ifeq ($(CLEAR_FRONT_PACKAGES), yes)
151163
make clear-front

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
## Quickstart
3737

3838
* Install docker for <a href="https://docs.docker.com/install/" target="_blank">Linux</a>, <a href="https://docs.docker.com/docker-for-mac/install/" target="_blank">Mac</a>, <a href="https://docs.docker.com/docker-for-windows/install/" target="_blank">Windows</a>
39-
* Check <a href="https://docs.docker.com/install/linux/linux-postinstall/" target="_blank">post-installation steps for Linux</a>
40-
* Install <a href="https://docs.docker.com/compose/install/" target="_blank">docker compose</a>
39+
* Check <a href="https://docs.docker.com/install/linux/linux-postinstall/" target="_blank">post-installation steps for Linux</a> version 17.12.0 or later
40+
* Install <a href="https://docs.docker.com/compose/install/" target="_blank">docker compose</a> version 1.21.0 or later
4141

4242
* Copy **.env.default** to **.env**, more information about enviroment file can be found <a href="https://docs.docker.com/compose/env-file/" target="_blank">docs.docker.com</a>
4343
* Copy **docker-compose.override.yml.default** to **docker-compose.override.yml**, update parts you want to overwrite.
@@ -117,6 +117,8 @@ networks:
117117
* `make front` - Builds frontend tasks.
118118
* `make lint` - Runs frontend linters.
119119
* `make storybook` - Runs storybook in current theme.
120+
* `make blackfire` - Adds and enables blackfire.io php extension, needs [configuration](https://blackfire.io/docs/configuration/php) in docker-composer override.yml.
121+
* `make newrelic` - Adds and enables newrelic.com php extension, needs [configuration](https://docs.newrelic.com/docs/agents/php-agent/getting-started/introduction-new-relic-php#configuration) `NEW_RELIC_LICENSE_KEY` environment variable defined with valid license key.
120122

121123
#### Additional goals
122124

composer.json

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,13 @@
1313
{
1414
"type": "composer",
1515
"url": "https://packages.drupal.org/8"
16-
},
17-
{
18-
"type": "package",
19-
"package": {
20-
"name": "drupal/lb_ux",
21-
"version": "dev-8.x-1.x",
22-
"type": "drupal-module",
23-
"source": {
24-
"url": "https://git.drupalcode.org/project/lb_ux.git",
25-
"type": "git",
26-
"reference": "8.x-1.x"
27-
}
28-
}
29-
},
30-
{
31-
"type": "package",
32-
"package": {
33-
"name": "drupal/panels_everywhere",
34-
"version": "dev-8.x-4.x",
35-
"type": "drupal-module",
36-
"source": {
37-
"url": "https://git.drupalcode.org/project/panels_everywhere.git",
38-
"type": "git",
39-
"reference": "8.x-4.x"
40-
}
41-
}
4216
}
4317
],
4418
"require": {
4519
"composer/installers": "^1.9",
4620
"cweagans/composer-patches": "^1.6.5",
4721
"drupal/better_normalizers": "^1.0@beta",
48-
"drupal/block_content_permissions": "1.x-dev",
22+
"drupal/block_content_permissions": "^1",
4923
"drupal/core-composer-scaffold": "^9.0",
5024
"drupal/core-project-message": "^9.0",
5125
"drupal/core-recommended": "^9",
@@ -58,13 +32,13 @@
5832
"drupal/layout_builder_modal": "^1.1",
5933
"drupal/layout_builder_restrictions": "^2.7",
6034
"drupal/layout_library": "^1.0@beta",
61-
"drupal/lb_ux": "dev-8.x-1.x",
35+
"drupal/lb_ux": "1.x-dev",
6236
"drupal/manage_display": "^1.0@alpha",
6337
"drupal/menu_admin_per_menu": "^1.1",
64-
"drupal/menu_link_attributes": "1.x-dev",
38+
"drupal/menu_link_attributes": "^1.1",
6539
"drupal/page_manager": "^4.0.0-beta6",
6640
"drupal/panels": "^4.6",
67-
"drupal/panels_everywhere": "dev-8.x-4.x",
41+
"drupal/panels_everywhere": "^4.0@beta",
6842
"drupal/paragraphs": "^1.11",
6943
"drupal/pathauto": "^1.8",
7044
"drupal/rabbit_hole": "^1.0.0-beta7",
@@ -78,7 +52,7 @@
7852
"drupal/webform": "^6",
7953
"drush/drush": "^10.1.0",
8054
"skilldlabs/drupal-cleanup": "^1",
81-
"zaporylie/composer-drupal-optimizations": "^1.0"
55+
"zaporylie/composer-drupal-optimizations": "^1.2"
8256
},
8357
"require-dev": {
8458
"dmore/behat-chrome-extension": "^1.3",
@@ -98,8 +72,6 @@
9872
"config": {
9973
"sort-packages": true,
10074
"preferred-install": {
101-
"drupal/lb_ux": "source",
102-
"drupal/panels_everywhere": "source",
10375
"*": "dist"
10476
}
10577
},
@@ -152,7 +124,8 @@
152124
"drupal-module": [
153125
"tests",
154126
"src/Tests"
155-
]
127+
],
128+
"exclude": []
156129
},
157130
"patches": {
158131
"drupal/core": {
@@ -182,15 +155,11 @@
182155
},
183156
"drupal/lb_ux": {
184157
"Cog icon not showing when Preview disabled": "https://www.drupal.org/files/issues/2020-05-22/3116402-8.patch",
185-
"Errors when using with modules that alter a section's contextual menu": "https://www.drupal.org/files/issues/2020-05-22/3106939-4.patch",
186-
"Indicate Drupal 8/9 compatibility via core_version_requirement": "https://www.drupal.org/files/issues/2020-05-22/d9_compatibility-3138698-4.patch"
158+
"Errors when using with modules that alter a section's contextual menu": "https://www.drupal.org/files/issues/2020-05-22/3106939-4.patch"
187159
},
188160
"drupal/menu_link_attributes": {
189161
"Add missing schema for menu_link_attributes": "https://patch-diff.githubusercontent.com/raw/yannickoo/menu_link_attributes/pull/52.patch"
190162
},
191-
"drupal/panels_everywhere": {
192-
"Drupal 9 compatibility fixes for Panels Everywhere": "https://www.drupal.org/files/issues/2020-05-14/d9-compatibility-3111407-7.patch"
193-
},
194163
"drupal/upgrade_status": {
195164
"Exclude node_modules from scan": "https://www.drupal.org/files/issues/2020-08-14/3162997-8.patch"
196165
}

0 commit comments

Comments
 (0)