|
| 1 | +SHELL = /bin/sh |
| 2 | + |
| 3 | +.PHONY: install composer clean help |
| 4 | +.PHONY: test test-unit test-intergration test-coverage test-matrix |
| 5 | + |
| 6 | +.SILENT: help |
| 7 | + |
| 8 | +install: ## Download the depenedencies then build the image :rocket:. |
| 9 | + make 'composer-install --optimize-autoloader --ignore-platform-reqs' |
| 10 | + docker build --tag graze-queue:latest . |
| 11 | + |
| 12 | +composer-%: ## Run a composer command, `make "composer-<command> [...]"`. |
| 13 | + docker run -it --rm \ |
| 14 | + -v $$(pwd):/app \ |
| 15 | + -v ~/.composer:/root/composer \ |
| 16 | + -v ~/.ssh/id_rsa:/root/.ssh/id_rsa:ro \ |
| 17 | + -v ~/.ssh/known_hosts:/root/.ssh/known_hosts:ro \ |
| 18 | + composer/composer:master --no-interaction $* |
| 19 | + |
| 20 | + |
| 21 | +test: ## Run the unit and intergration testsuites. |
| 22 | +test: test-unit test-intergration |
| 23 | + |
| 24 | +test-unit: ## Run the unit testsuite. |
| 25 | + docker run --rm -t graze-queue \ |
| 26 | + vendor/bin/phpunit --testsuite unit |
| 27 | + |
| 28 | +test-intergration: ## Run the integration testsuite. |
| 29 | + docker run --rm -t graze-queue \ |
| 30 | + vendor/bin/phpunit --testsuite integration |
| 31 | + |
| 32 | +test-coverage: ## Run the testsuites with coverage enabled. |
| 33 | + docker run --rm -t graze-queue \ |
| 34 | + vendor/bin/phpunit --coverage-text --testsuite unit |
| 35 | + docker run --rm -t graze-queue \ |
| 36 | + vendor/bin/phpunit --coverage-text --testsuite integration |
| 37 | + |
| 38 | +test-matrix: |
| 39 | + docker run --rm -t -v $$(pwd):/opt/graze/queue -w /opt/graze/queue php:5.5-cli \ |
| 40 | + vendor/bin/phpunit --testsuite unit |
| 41 | + docker run --rm -t -v $$(pwd):/opt/graze/queue -w /opt/graze/queue php:5.6-cli \ |
| 42 | + vendor/bin/phpunit --testsuite unit |
| 43 | + docker run --rm -t -v $$(pwd):/opt/graze/queue -w /opt/graze/queue php:7.0-cli \ |
| 44 | + vendor/bin/phpunit --testsuite unit |
| 45 | + |
| 46 | + |
| 47 | +clean: ## Stop running containers and clean up an images. |
| 48 | + docker rmi graze-queue:latest |
| 49 | + |
| 50 | +help: ## Show this help message. |
| 51 | + echo "usage: make [target] ..." |
| 52 | + echo "" |
| 53 | + echo "targets:" |
| 54 | + fgrep --no-filename "##" $(MAKEFILE_LIST) | fgrep --invert-match $$'\t' | sed -e 's/## //' |
0 commit comments