Makefile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # default versions to test against
  2. # these can be overridden by setting the environment variables in the shell
  3. REDIS_VERSION=3.0.0
  4. PHP_VERSION=php-5.6.8
  5. YII_VERSION=dev-master
  6. # ensure all the configuration variables above are in environment of the shell commands below
  7. export
  8. help:
  9. @echo "make test - run phpunit tests using a docker environment"
  10. @echo "make clean - stop docker and remove container"
  11. test: docker adjust-config
  12. #composer require "yiisoft/yii2:${YII_VERSION}" --prefer-dist
  13. #composer install --prefer-dist
  14. docker run --rm=true -v $(shell pwd):/opt/test --link $(shell cat tests/dockerids/redis):redis yiitest/php:${PHP_VERSION} phpunit --verbose --color
  15. adjust-config:
  16. echo "<?php \$$config['databases']['redis']['port'] = 6379; \$$config['databases']['redis']['hostname'] = 'redis';" > tests/data/config.local.php
  17. docker: build-docker
  18. docker run -d -P yiitest/redis:${REDIS_VERSION} > tests/dockerids/redis
  19. build-docker:
  20. test -d tests/docker || git clone https://github.com/cebe/jenkins-test-docker tests/docker
  21. cd tests/docker && git checkout -- . && git pull
  22. cd tests/docker/php && sh build.sh
  23. cd tests/docker/redis && sh build.sh
  24. mkdir -p tests/dockerids
  25. clean:
  26. docker stop $(shell cat tests/dockerids/redis)
  27. docker rm $(shell cat tests/dockerids/redis)
  28. rm tests/dockerids/redis