forked from skilld-labs/skilld-docker-container
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rellocation of tests makefile targets and housekeeping
- Loading branch information
David Ferlay
committed
Jul 26, 2019
1 parent
2a9708c
commit 893b903
Showing
10 changed files
with
180 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
COMPOSE_FILE=./docker/docker-compose.yml:./docker/docker-compose.override.yml | ||
COMPOSE_PROJECT_NAME=projectname | ||
PROFILE_NAME=sdd | ||
MODULES=skilld_default_content | ||
MODULES=project_default_content | ||
THEME_NAME= | ||
SITE_NAME=Example | ||
[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ | |
| COMPOSE_FILE | Path to a Compose file(s) | `./docker/docker-compose.yml:./docker/docker-compose.override.yml` | | ||
| COMPOSE_PROJECT_NAME | Your project name | - | | ||
| PROFILE_NAME | Profile used for site install | sdd | | ||
| MODULES | Additional modules to enable after site install | skilld_default_content | | ||
| MODULES | Additional modules to enable after site install | project_default_content | | ||
| THEME_NAME | Theme name used for frontend | - | | ||
| SITE_NAME | Site name | Example | | ||
| SITE_MAIL | Site e-mail address | [email protected] | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Function for code sniffer images. | ||
phpcsexec = docker run --rm \ | ||
-v $(shell pwd)/web/profiles/$(PROFILE_NAME):/work/profile \ | ||
-v $(shell pwd)/web/modules/custom:/work/modules \ | ||
-v $(shell pwd)/web/themes/custom:/work/themes \ | ||
skilldlabs/docker-phpcs-drupal ${1} -s --colors \ | ||
--standard=Drupal,DrupalPractice \ | ||
--extensions=php,module,inc,install,profile,theme,yml,txt,md,js \ | ||
--ignore=*.css,libraries/*,dist/*,styleguide/*,README.md,README.txt \ | ||
. | ||
|
||
## Validate codebase with phpcs sniffers to make sure it conforms https://www.drupal.org/docs/develop/standards | ||
phpcs: | ||
@echo "Phpcs validation..." | ||
@$(call phpcsexec, phpcs) | ||
|
||
## Fix codebase according to Drupal standards https://www.drupal.org/docs/develop/standards | ||
phpcbf: | ||
@$(call phpcsexec, phpcbf) | ||
|
||
|
||
## Add symbolic link from custom script(s) to .git/hooks/ | ||
hooksymlink: | ||
# Check if .git directory exists | ||
ifneq ($(wildcard .git/.*),) | ||
# Check if script file exists | ||
ifneq ("$(wildcard scripts/git_hooks/sniffers.sh)","") | ||
@echo "Removing previous git hooks and installing fresh ones" | ||
$(shell find .git/hooks -type l -exec unlink {} \;) | ||
$(shell ln -sf ../../scripts/git_hooks/sniffers.sh .git/hooks/pre-push) | ||
else | ||
@echo "scripts/git_hooks/sniffers.sh file does not exist" | ||
endif | ||
else | ||
@echo "No git directory found, git hooks won't be installed" | ||
endif | ||
|
||
|
||
## Validate langcode of base config files | ||
clang: | ||
ifneq ("$(wildcard scripts/makefile/baseconfig-langcode.sh)","") | ||
@echo "Base config langcode validation..." | ||
@/bin/sh ./scripts/makefile/baseconfig-langcode.sh | ||
else | ||
@echo "scripts/makefile/baseconfig-langcode.sh file does not exist" | ||
endif | ||
|
||
|
||
## Validate configuration schema | ||
cinsp: | ||
ifneq ("$(wildcard scripts/makefile/config-inspector-validation.sh)","") | ||
@echo "Config schema validation..." | ||
$(call php, composer install -o) | ||
@$(call php, /bin/sh ./scripts/makefile/config-inspector-validation.sh) | ||
else | ||
@echo "scripts/makefile/config-inspector-validation.sh file does not exist" | ||
endif | ||
|
||
|
||
## Validate composer.json file | ||
compval: | ||
@echo "Composer.json validation..." | ||
@docker run --rm -v `pwd`:`pwd` -w `pwd` $(IMAGE_PHP) composer validate --strict | ||
|
||
|
||
## Validate watchdog logs | ||
watchdogval: | ||
ifneq ("$(wildcard scripts/makefile/watchdog-validation.sh)","") | ||
@echo "Watchdog validation..." | ||
@$(call php, /bin/sh ./scripts/makefile/watchdog-validation.sh) | ||
else | ||
@echo "scripts/makefile/watchdog-validation.sh file does not exist" | ||
endif | ||
|
||
|
||
## Validate drupal-check | ||
drupalcheckval: | ||
@echo "Drupal-check validation..." | ||
$(call php, composer install -o) | ||
$(call php, vendor/bin/drupal-check -V) | ||
$(call php, vendor/bin/drupal-check -ad -vv -n --no-progress web/modules/custom/) | ||
|
||
## Validate Behat scenarios | ||
behat: | ||
@echo "Getting base url" | ||
ifdef REVIEW_DOMAIN | ||
$(eval BASE_URL := $(MAIN_DOMAIN_NAME)) | ||
else | ||
$(eval BASE_URL := $(shell docker inspect --format="{{.NetworkSettings.Networks.$(COMPOSE_NET_NAME).IPAddress}}" $(COMPOSE_PROJECT_NAME)_web)) | ||
endif | ||
ifeq ($(shell docker ps -f 'name=$(COMPOSE_PROJECT_NAME)_chrome' --format '{{.Names}}'), ) | ||
@echo 'Browser driver is stoped. Running it.' | ||
make -s browser_driver | ||
endif | ||
@echo "Replacing URL_TO_TEST value in behat.yml with http://$(BASE_URL)" | ||
$(call php, cp behat.default.yml behat.yml) | ||
$(call php, sed -i "s/URL_TO_TEST/http:\/\/$(BASE_URL)/" behat.yml) | ||
@echo "Running Behat scenarios against http://$(BASE_URL)" | ||
$(call php, composer install -o) | ||
$(call php, vendor/bin/behat -V) | ||
$(call php, vendor/bin/behat --colors) | ||
|
||
behatdl: | ||
$(call php, vendor/bin/behat -dl --colors) | ||
|
||
behatdi: | ||
$(call php, vendor/bin/behat -di --colors) | ||
|
||
## Run browser driver for behat tests | ||
browser_driver: | ||
docker run -d --init --rm --name $(COMPOSE_PROJECT_NAME)_chrome \ | ||
--network container:$(COMPOSE_PROJECT_NAME)_php $(IMAGE_DRIVER) \ | ||
--remote-debugging-address=0.0.0.0 --remote-debugging-port=9222 --no-sandbox \ | ||
--entrypoint "" chromium-browser --headless --disable-gpu \ | ||
--window-size=1200,2080 \ | ||
--disable-web-security | ||
|
||
## Stop browser driver | ||
browser_driver_stop: | ||
docker stop $(COMPOSE_PROJECT_NAME)_chrome | ||
|
||
## Run sniffer validations (executed as git hook, by scripts/git_hooks/sniffers.sh) | ||
sniffers: | clang compval phpcs | ||
|
||
## Run all tests & validations (including sniffers) | ||
tests: | sniffers behat cinsp drupalcheckval watchdogval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Skilld default content | ||
|
||
## How to use ? | ||
|
||
1. Enable module default_content. It should be already installed by composer. | ||
2. Create content manually on site using UID1 admin user | ||
3. Use `drush dcer` commands (brought by module) to export selected content : | ||
``` | ||
drush dcer node <node id> --folder=modules/custom/project_default_content/content | ||
drush dcer user <user id> --folder=modules/custom/project_default_content/content | ||
drush dcer block_content <content id> --folder=modules/custom/project_default_content/content | ||
drush dcer menu_link_content <link id> --folder=modules/custom/project_default_content/content | ||
drush dcer taxonomy_term <term id> --folder=modules/custom/project_default_content/content | ||
drush dcer file <file id> --folder=modules/custom/project_default_content/content | ||
drush dcer media <media id> --folder=modules/custom/project_default_content/content | ||
``` | ||
4. Find out what is UUID of admin user : `ls web/modules/custom/project_default_content/content/user` | ||
- `4bad48eb-ff5b-45b4-b30c-ecabff09591a` : UUID of default_content_author user | ||
- Another UUID should be listed here : UUID of admin user | ||
5. Delete json file of admin user : | ||
- `rm web/modules/custom/project_default_content/content/user/UUID_OF_ADMIN_USER.json` | ||
6. Use _sed_ commands to replace UID and UUID values of admin author in files of all exported content : | ||
- `cd web/modules/custom/project_default_content/content/` | ||
- `find . -type f -exec sed -i 's/\/user\\\/1/\/user\\\/2/g' {} +` | ||
- `find . -type f -exec sed -i 's/UUID_OF_ADMIN_USER/4bad48eb-ff5b-45b4-b30c-ecabff09591a' {} +` | ||
7. Exported default content will be created at build and it's author should be `default_content_author` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ | |
], | ||
"mail": [ | ||
{ | ||
"value": "[email protected]" | ||
"value": "" | ||
} | ||
], | ||
"timezone": [ | ||
|
@@ -80,7 +80,7 @@ | |
], | ||
"init": [ | ||
{ | ||
"value": "[email protected]" | ||
"value": "" | ||
} | ||
], | ||
"default_langcode": [ | ||
|
Oops, something went wrong.