1
1
SHELL = /bin/sh
2
2
3
3
DOCKER ?= $(shell which docker)
4
- DOCKER_REPOSITORY := graze/php-alpine:7.1-test
5
- VOLUME := /opt/ graze/queue
6
- VOLUME_MAP := -v $$( pwd ) :${VOLUME}
7
- DOCKER_RUN_BASE := ${DOCKER} run --rm -t ${VOLUME_MAP } -w ${VOLUME}
8
- DOCKER_RUN := ${DOCKER_RUN_BASE} ${DOCKER_REPOSITORY }
4
+ PHP_VER := 7.2
5
+ IMAGE := graze/php-alpine:${PHP_VER}-test
6
+ VOLUME := /srv
7
+ DOCKER_RUN_BASE := ${DOCKER} run --rm -t -v $$( pwd ) :${VOLUME } -w ${VOLUME}
8
+ DOCKER_RUN := ${DOCKER_RUN_BASE} ${IMAGE }
9
9
10
- .PHONY : install composer clean help run
11
- .PHONY : test lint lint-fix test-unit test-integration test-matrix test-coverage test-coverage-html test-coverage-clover
10
+ PREFER_LOWEST ?=
11
+
12
+ .PHONY : install composer help
13
+ .PHONY : test lint lint-fix test-unit test-integration test-matrix test-matrix-lowest
14
+ .PHONY : test-coverage test-coverage-html test-coverage-clover
12
15
13
16
.SILENT : help
14
17
15
18
# Building
16
19
17
- build : # # Download the dependencies
18
- make ' composer-install --optimize-autoloader'
20
+ build : # # Install the dependencies
21
+ build : ensure-composer-file
22
+ make ' composer-install --optimize-autoloader --prefer-dist ${PREFER_LOWEST}'
23
+
24
+ build-update : # # Update the dependencies
25
+ build-update : ensure-composer-file
26
+ make ' composer-update --optimize-autoloader --prefer-dist ${PREFER_LOWEST}'
19
27
20
- build-update : # # Update and download the dependencies
21
- make ' composer-update --optimize-autoloader '
28
+ ensure-composer-file : # Update the composer file
29
+ make ' composer-config platform.php ${PHP_VER} '
22
30
23
31
composer-% : # # Run a composer command, `make "composer-<command> [...]"`.
24
32
${DOCKER} run -t --rm \
25
33
-v $$(pwd ) :/app:delegated \
26
34
-v ~/.composer :/tmp:delegated \
27
- composer --no-interaction --prefer-dist $* $(filter-out $@,$(MAKECMDGOALS))
35
+ -v ~/.ssh :/root/.ssh:ro \
36
+ composer --ansi --no-interaction $* $(filter-out $@,$(MAKECMDGOALS))
28
37
29
38
# Testing
30
39
@@ -43,12 +52,15 @@ test-unit: ## Run the unit testsuite.
43
52
test-integration : # # Run the integration testsuite.
44
53
${DOCKER_RUN} vendor/bin/phpunit --colors=always --testsuite integration
45
54
55
+ test-matrix-lowest : # # Test all version, with the lowest version
56
+ ${MAKE} test-matrix PREFER_LOWEST=' --prefer-lowest --prefer-stable'
57
+ ${MAKE} build-update
58
+
46
59
test-matrix : # # Run the unit tests against multiple targets.
47
- make DOCKER_REPOSITORY=" php:5.6-alpine" test
48
- make DOCKER_REPOSITORY=" php:7.0-alpine" test
49
- make DOCKER_REPOSITORY=" php:7.1-alpine" test
50
- make DOCKER_REPOSITORY=" php:7.2-alpine" test
51
- make DOCKER_REPOSITORY=" hhvm/hhvm:latest" test
60
+ ${MAKE} PHP_VER=" 5.6" build-update test
61
+ ${MAKE} PHP_VER=" 7.0" build-update test
62
+ ${MAKE} PHP_VER=" 7.1" build-update test
63
+ ${MAKE} PHP_VER=" 7.2" build-update test
52
64
53
65
test-coverage : # # Run all tests and output coverage to the console.
54
66
${DOCKER_RUN} phpdbg7 -qrr vendor/bin/phpunit --coverage-text
0 commit comments