-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
138 lines (107 loc) · 4.98 KB
/
Copy pathMakefile
File metadata and controls
138 lines (107 loc) · 4.98 KB
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
COMPOSE ?= docker compose
PHP_SERVICE = php
WP_SERVICE = wordpress
DB_SERVICE = db
WPCLI_SERVICE = wpcli
JS_SERVICE = javascript
WPCLI_PLUGIN_WORKDIR = /var/www/html/wp-content/plugins/basicrum
PLUGIN_DIR = plugins/basicrum
PLUGIN_WORKDIR = /workspace
TEST_DB_NAME = wordpress_test
TEST_DB_USER = root
TEST_DB_PASS = root
TEST_DB_HOST = db
WP_TEST_VERSION ?= latest
.PHONY: help build up down restart logs shell composer-install wp-install lint lint-fix lint-php analyse composer-validate composer-audit conventions translations js-install js-test woocommerce-e2e woocommerce-e2e-up woocommerce-e2e-down integration-setup integration test package package-verify package-smoke clean
help:
@echo "Targets:"
@echo " build Build or rebuild local Docker images"
@echo " up Start and provision local WordPress with Basicrum active"
@echo " wp-install Install WordPress and activate Basicrum if needed"
@echo " down Stop containers"
@echo " restart Restart containers"
@echo " logs Tail logs from WordPress and MySQL"
@echo " shell Open a shell in the PHP container"
@echo " composer-install Install Composer dependencies in container"
@echo " lint-php Run PHP syntax lint"
@echo " lint Run PHPCS"
@echo " lint-fix Run PHPCBF"
@echo " analyse Run PHPStan static analysis"
@echo " composer-validate Validate Composer metadata and lock file"
@echo " composer-audit Audit locked Composer dependencies"
@echo " conventions Enforce ASCII hyphens and version consistency"
@echo " translations Update the POT translation template"
@echo " js-install Install locked JavaScript test dependencies"
@echo " js-test Run loader behavior tests in Chromium"
@echo " woocommerce-e2e Run WooCommerce page-type browser tests"
@echo " woocommerce-e2e-up Start the inspectable WooCommerce test stack on port 9081"
@echo " woocommerce-e2e-down Stop and reset the inspectable WooCommerce test stack"
@echo " unit Run unit tests"
@echo " integration-setup Install WordPress test suite inside containers"
@echo " integration Run integration tests"
@echo " test Run unit and integration tests"
@echo " package Build and inspect the release ZIP and checksum"
@echo " package-verify Inspect the existing release ZIP and checksum"
@echo " package-smoke Install and test the release ZIP in clean WordPress"
build:
$(COMPOSE) build $(PHP_SERVICE)
up:
$(MAKE) composer-install
$(MAKE) wp-install
wp-install:
$(COMPOSE) up -d $(DB_SERVICE) $(WP_SERVICE)
$(COMPOSE) run --rm $(WPCLI_SERVICE) sh /tools/setup-wordpress.sh
down:
$(COMPOSE) down
restart: down up
logs:
$(COMPOSE) logs -f $(WP_SERVICE) $(DB_SERVICE)
shell:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) bash
composer-install:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer install --no-interaction --prefer-dist
lint-php:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer lint:php
lint:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer lint
lint-fix:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer lint:fix
analyse:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer analyse
composer-validate:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer validate --strict
composer-audit:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer audit --locked
conventions:
sh tools/verify-ascii-hyphens.sh
sh tools/verify-version-consistency.sh
sh tools/verify-boomerang-provenance.sh
translations:
$(COMPOSE) run --rm --no-deps --user "$$(id -u):$$(id -g)" -e HOME=/tmp -w $(WPCLI_PLUGIN_WORKDIR) $(WPCLI_SERVICE) sh /tools/update-translations.sh .
js-install:
$(COMPOSE) run --rm --no-deps --user "$$(id -u):$$(id -g)" -e HOME=/tmp $(JS_SERVICE) npm ci --no-audit --no-fund
js-test: js-install
$(COMPOSE) run --rm --no-deps --user "$$(id -u):$$(id -g)" -e HOME=/tmp $(JS_SERVICE) npm run test:js
woocommerce-e2e:
sh tools/run-woocommerce-e2e.sh
woocommerce-e2e-up:
sh tools/up-woocommerce-e2e.sh
woocommerce-e2e-down:
sh tools/down-woocommerce-e2e.sh
unit:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer unit
integration-setup:
$(COMPOSE) up -d $(DB_SERVICE)
$(COMPOSE) run --rm $(PHP_SERVICE) bash /tools/install-wp-tests.sh $(TEST_DB_NAME) $(TEST_DB_USER) $(TEST_DB_PASS) $(TEST_DB_HOST) $(WP_TEST_VERSION)
integration:
$(COMPOSE) run --rm -w $(PLUGIN_WORKDIR) $(PHP_SERVICE) composer integration
test: unit integration js-test
package:
$(COMPOSE) run --rm --no-deps -w /repo $(PHP_SERVICE) sh /tools/build-release.sh /repo/$(PLUGIN_DIR) /repo/release
package-verify:
$(COMPOSE) run --rm --no-deps -w /repo $(PHP_SERVICE) sh /tools/verify-release.sh /repo/release/basicrum.zip
package-smoke: package
sh tools/smoke-test-release.sh release/basicrum.zip
clean:
$(COMPOSE) down -v
rm -rf release