-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
111 lines (94 loc) · 4.53 KB
/
Makefile
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
include docker.mk
BEHAT ?= "vendor/bin/behat"
SITE ?= "default"
FRONTEND_BASE_PATH = "/var/www/html/web/themes/custom"
PROFILE ?= "minimal"
ENVIRONMENT ?= "stg"
frontend_target ?= "example"
backstopjs_type ?= "functional"
## info : Show project info
.PHONY: info
info:
@scripts/get_info.sh
## test : Run Unit tests. Pass the path to a file or directory with the Unit test. Example: make test web/modules/contrib/devel/tests/src/Unit
.PHONY: test
test:
docker compose exec php phpunit $(filter-out $@,$(MAKECMDGOALS))
## behat : Run project Behat tests
.PHONY: behat
behat:
docker compose exec php ${BEHAT} --colors
## ngrok : Setup a ngrok tunnel to make the site available
.PHONY: ngrok
ngrok:
docker compose -f compose.yml -f compose.override.yml -f compose.ngrok.yml up -d && docker compose exec php curl http://ngrok:4040/api/tunnels | grep -Po "https"://[^\"]+
## ngrok-stop : Stop the created ngrok tunnel
.PHONY: ngrok-stop
ngrok-stop:
docker compose -f compose.yml -f compose.override.yml -f compose.ngrok.yml stop ngrok && docker compose -f compose.yml -f compose.override.yml -f compose.ngrok.yml rm -fsv ngrok
## frontend : Generate frontend assets like compiling scss
.PHONY: frontend
frontend:
docker compose exec -w ${FRONTEND_BASE_PATH}/$(frontend_target) node sh ${DOCKER_PROJECT_ROOT}/scripts/frontend-build.sh $(filter-out $@,$(MAKECMDGOALS))
## backstopjs-reference : Generate BackstopJS reference files
## An optional parameter is available to generate only scenarios matching it.
## If the param is not added all references will be generated.
## Example: make backstopjs-reference "Scenario Label Regex"
## There also exists the backstopjs_type paramter which allows selecting the type of test you want run.
## Example: make backstopjs_type=functional backstopjs-test
## Example: make backstopjs_type=environment/pro backstopjs-test
.PHONY: backstopjs-reference
backstopjs-reference:
docker compose exec -T backstopjs sh -c "cd tests/${backstopjs_type}/backstopjs && backstop reference --filter='$(filter-out $@,$(MAKECMDGOALS))'"
## backstopjs-test : Run BackstopJS tests
## An optional parameter is available to generate only scenarios matching it.
## If the param is not added all tests will be run.
## Example: make backstopjs-test "Scenario Label Regex"
## There also exists the backstopjs_type paramter which allows selecting the type of test you want run.
## Example: make backstopjs_type=functional backstopjs-test
## Example: make backstopjs_type=environment/pro backstopjs-test
.PHONY: backstopjs-test
backstopjs-test:
docker compose exec -T backstopjs sh -c "cd tests/${backstopjs_type}/backstopjs && backstop test --filter='$(filter-out $@,$(MAKECMDGOALS))'"
## setup-init : Prepares the site
.PHONY: setup-init
setup-init:
mkdir -p web/sites/default/files/behat/errors
chmod u+w web/sites/${SITE} -R
cp compose.override.yml.dist compose.override.yml
cp web/sites/${SITE}/example.settings.local.php web/sites/${SITE}/settings.local.php
cp web/sites/${SITE}/example.local.drush.yml web/sites/${SITE}/local.drush.yml
docker compose up -d
docker compose exec -T php composer install
docker compose run -e'PHP_ERROR_REPORTING=E_ALL & ~E_DEPRECATED' --rm -T php 'vendor/bin/grumphp' 'git:init'
## setup : Prepares the site and installs it using the Drupal configuration files
.PHONY: setup
setup:
make setup-init
docker compose exec -T php drush @${SITE}.local si ${PROFILE} --existing-config --sites-subdir=${SITE} -y
docker compose exec -T php drush @${SITE}.local cim -y
docker compose exec -T php drush @${SITE}.local cr
docker compose exec -T php drush @${SITE}.local uli
## setup-from-environment : Prepares the site and loads it with data from the reference site
.PHONY: setup-from-environment
setup-from-environment:
make setup-init
./scripts/reload-local.sh --site=${SITE} --env=${ENVIRONMENT}
## solr-sync : Reload docker Solr cores from local files.
.PHONY: solr-sync
solr-sync:
./scripts/solr-sync.sh ${PROJECT_NAME} ${SOLR_CONTAINER} ${CORES}
## solr-rebuild : Re-creates the Solr core
.PHONY: solr-rebuild
solr-rebuild:
docker compose stop solr && docker compose rm -f solr && docker compose up -d solr && make solr-sync
## pa11y: Run pa11y tests
.PHONY: pa11y
pa11y:
docker compose run --rm -T pa11y $(filter-out $@,$(MAKECMDGOALS))
## lighthouse: Run lighthouse tests
.PHONY: lighthouse
lighthouse:
docker compose exec -T lighthouse lhci autorun || true
docker compose exec -T lighthouse sh -c 'tar -cf - *.json *.html' | tar -xvf - -C reports/lighthouse/
ls -l reports/lighthouse/