-
Notifications
You must be signed in to change notification settings - Fork 574
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (56 loc) · 2.7 KB
/
Copy pathMakefile
File metadata and controls
73 lines (56 loc) · 2.7 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
# Twilio API helper library.
# See LICENSE file for copyright and license details.
.PHONY: all clean install test test-docker docs docs-new authors docker-dev-build docker-dev-clean docker-dev-test
COMPOSER = $(shell which composer)
ifeq ($(strip $(COMPOSER)),)
COMPOSER = php composer.phar
endif
PHPVERSION = $(shell php -r 'echo PHP_VERSION;')
all: test
clean:
@rm -rf docs venv vendor
install: clean
@composer --version || (curl -s https://getcomposer.org/installer | php);
$(COMPOSER) install
vendor: install
test:
@PATH=vendor/bin:$(PATH) phpunit -d memory_limit=512M --strict-coverage --disallow-test-output --colors --configuration tests/phpunit.xml --coverage-clover=coverage.xml
test-docker:
docker build -t twilio/twilio-php .
docker run twilio/twilio-php phpunit -d memory_limit=512M --disallow-test-output --colors --configuration tests/phpunit.xml
PHPDOX_PHAR=phpdox.phar
PHP74 = $(shell command -v /opt/homebrew/opt/php@7.4/bin/php 2>/dev/null || echo php)
docs-install:
docs:
${PHP74} ${PHPDOX_PHAR}
# todo: enable locally
# PHPDOC_PHAR=phpDocumentor.phar
# # phpDocumentor: alternative to phpdox, works with PHP 8.x (no PHP 7.4 required)
# docs-new:
# @test -f ${PHPDOC_PHAR} || curl -sL https://phpdoc.org/${PHPDOC_PHAR} -o ${PHPDOC_PHAR}
# php ${PHPDOC_PHAR} -d src/ -t docs/api
authors:
echo "Authors\n=======\n\nA huge thanks to all of our contributors:\n\n" > AUTHORS.md
git log --raw | grep "^Author: " | cut -d ' ' -f2- | cut -d '<' -f1 | sed 's/^/- /' | sort | uniq >> AUTHORS.md
API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
CURRENT_TAG=$(shell expr "${GITHUB_TAG}" : ".*-rc.*" >/dev/null && echo "rc" || echo "latest")
docker-build:
docker build -t twilio/twilio-php .
docker tag twilio/twilio-php twilio/twilio-php:${GITHUB_TAG}
docker tag twilio/twilio-php twilio/twilio-php:apidefs-${API_DEFINITIONS_SHA}
docker tag twilio/twilio-php twilio/twilio-php:${CURRENT_TAG}
docker-push:
docker push twilio/twilio-php:${GITHUB_TAG}
docker push twilio/twilio-php:apidefs-${API_DEFINITIONS_SHA}
docker push twilio/twilio-php:${CURRENT_TAG}
docker-dev-build:
-docker stop twilio_php${VERSION}
-docker rm twilio_php${VERSION}
docker image build --tag="twilio/php${VERSION}" --build-arg version=${VERSION} -f ./Dockerfile-dev .
docker run -td --name="twilio_php${VERSION}" --mount type=bind,source=${PWD},target=/twilio twilio/php${VERSION} /bin/bash
docker-dev-clean:
docker ps --format '{{.Names}}' | grep "^twilio_php" | xargs -I {} sh -c "docker stop {} && docker rm {}" > /dev/null
docker-dev-test:
docker exec -t twilio_php${VERSION} /bin/bash -c 'make all'
cluster-test:
@PATH=vendor/bin:$(PATH) phpunit --filter ClusterTest tests/Twilio/ClusterTest.php