Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (119 loc) · 5.17 KB
/
Copy pathMakefile
File metadata and controls
157 lines (119 loc) · 5.17 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# Adapted from bitrix24/b24phpsdk v3, commit 8ebd4c154d5557db949b0196825f347a3a6c5bf0.
# Copyright (c) Maksim Mesilov. Distributed under BSD-3-Clause; see LICENSE.
.DEFAULT_GOAL := help
export COMPOSE_HTTP_TIMEOUT=120
export DOCKER_CLIENT_TIMEOUT=120
export LOCAL_UID ?= $(shell id -u)
export LOCAL_GID ?= $(shell id -g)
COMPOSE := sh ./scripts/compose.sh
RUN := $(COMPOSE) run --rm -T php-cli
CLI_RUN := $(COMPOSE) run --rm -T --env BITRIX24_WEBHOOK --env BITRIX24_PHP_SDK_PLAYGROUND_WEBHOOK --env B24CLI_TIMEOUT --env B24CLI_API_POLICY --env B24CLI_PROFILE --env B24CLI_TEST_DISK_FILE_ID --env B24CLI_TEST_RESTRICTED_WEBHOOK php-cli
ARGS ?=
TEST_ARGS ?=
.PHONY: package-phar package package-macos package-windows test-package
.PHONY: cli-reference cli-reference-check
cli-reference:
$(RUN) php scripts/cli-reference.php --write
cli-reference-check:
$(RUN) php scripts/cli-reference.php --check
package-phar:
bash build/package-linux.sh phar
package:
bash build/package-linux.sh linux
package-macos:
bash build/package-macos.sh $(ARGS)
package-windows:
pwsh -File build/package-windows.ps1 $(ARGS)
test-package:
python3 build/tests/smoke.py $(ARGS)
.PHONY: help docker-init docker-build docker-up docker-down docker-restart \
composer-install composer-update composer-dumpautoload composer \
composer-validate php-cli-bash cli lint check worktree-info test-worktree \
lint-allowed-licenses lint-cs-fixer lint-phpstan lint-rector lint-all test test-unit test-integration unit integration make-unit make-integration
help:
@printf '%s\n' \
'Bitrix24 CLI' \
'' \
'docker-init Build the PHP image and install dependencies' \
'docker-build Build the PHP image' \
'docker-up Start the development container' \
'docker-down Stop the development container' \
'docker-restart Restart the development container' \
'composer-install Install locked dependencies' \
'composer-update Update dependencies and composer.lock' \
'composer-dumpautoload Regenerate the Composer autoloader' \
'composer ARGS="..." Run Composer with arguments' \
'composer-validate Validate composer.json and composer.lock' \
'php-cli-bash Open a shell in the PHP container' \
'cli ARGS="..." Run bin/b24cli (default: command list)' \
'cli-reference Update docs/cli-command-map.md from public commands' \
'cli-reference-check Check the command map matches the current CLI' \
'package-phar Build the locked production PHAR in Docker' \
'package Build a test Linux binary from any clean checkout commit (Docker)' \
'package-macos Build the native macOS arm64 binary' \
'package-windows Build the native Windows amd64 binary' \
'test-package ARGS="..." Run the copied-artifact acceptance harness' \
'lint Check PHP syntax' \
'check Validate Composer, PHP syntax and CLI startup' \
'worktree-info Show this checkout and its Compose project' \
'test-worktree Verify two concurrent worktrees from committed HEAD' \
'lint-allowed-licenses Check dependency licenses' \
'lint-cs-fixer Check PHP code style (no source changes)' \
'lint-phpstan Run PHPStan static analysis' \
'lint-rector Check Rector rules (dry run)' \
'lint-all Run all four quality checks'
@printf '%s\n' 'unit Run unit-tests (no external portal)' \
'integration Run integration-tests against the real portal' \
'TEST_ARGS="..." PHPUnit filters, e.g. --group command:task:find' \
'test Alias for unit' \
'test-integration Alias for integration (.env.local/.env; skip without webhook)'
worktree-info:
@$(COMPOSE) --info
test-worktree:
bash ./tests/worktree-isolation.sh
docker-init:
$(MAKE) docker-build
$(MAKE) composer-install
docker-build:
$(COMPOSE) build php-cli
docker-up:
$(COMPOSE) up --build -d php-cli
docker-down:
$(COMPOSE) down --remove-orphans
docker-restart:
$(MAKE) docker-down
$(MAKE) docker-up
composer-install:
$(RUN) composer install --no-interaction
composer-update:
$(RUN) composer update --no-interaction
composer-dumpautoload:
$(RUN) composer dump-autoload
composer:
$(RUN) composer $(ARGS)
composer-validate:
$(RUN) composer validate --strict
php-cli-bash:
$(COMPOSE) run --rm php-cli sh
cli:
$(CLI_RUN) php bin/b24cli $(ARGS)
lint:
$(RUN) sh -c 'find src config tests -name "*.php" -exec php -l {} + && php -l bin/console && php -l bin/b24cli'
check: composer-validate lint
$(RUN) composer check-platform-reqs
$(RUN) php bin/console list --no-ansi
lint-allowed-licenses:
$(RUN) vendor/bin/composer-license-checker
lint-cs-fixer:
$(RUN) vendor/bin/php-cs-fixer check --verbose --diff
lint-phpstan:
$(RUN) vendor/bin/phpstan analyse --memory-limit=2G
lint-rector:
$(RUN) vendor/bin/rector process --dry-run
lint-all: lint-allowed-licenses lint-cs-fixer lint-phpstan lint-rector
test test-unit make-unit: unit
test-integration make-integration: integration
unit:
$(RUN) vendor/bin/phpunit --testsuite unit-tests $(TEST_ARGS)
integration:
$(CLI_RUN) vendor/bin/phpunit --testsuite integration-tests $(TEST_ARGS)