@@ -6,7 +6,7 @@ SHORT_NAME ?= $(COMPONENT)
66
77include versioning.mk
88
9- SHELLCHECK_PREFIX := docker run --rm - v ${CURDIR}:/workdir -w /workdir quay.io/deis/shell-dev shellcheck
9+ SHELLCHECK_PREFIX := docker run -v ${CURDIR}:/workdir -w /workdir quay.io/deis/shell-dev shellcheck
1010SHELL_SCRIPTS = $(wildcard rootfs/bin/* ) $(shell find "rootfs" -name '* .sh') $(wildcard _scripts/* .sh)
1111
1212# Test processes used in quick unit testing
@@ -30,6 +30,9 @@ docker-build: check-docker
3030 docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE} rootfs
3131 docker tag ${IMAGE} ${MUTABLE_IMAGE}
3232
33+ docker-build-test : check-docker
34+ docker build ${DOCKER_BUILD_FLAGS} -t ${IMAGE} .test -f rootfs/Dockerfile.test rootfs
35+
3336deploy : check-kubectl docker-build docker-push
3437 kubectl --namespace=deis patch deployment deis-$(COMPONENT ) --type=' json' -p=' [{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'
3538
@@ -42,36 +45,23 @@ commit-hook:
4245full-clean : check-docker
4346 docker images -q $(IMAGE_PREFIX )$(COMPONENT ) | xargs docker rmi -f
4447
45- postgres : check-docker
46- docker start postgres || docker run --restart=" always" -d -p 5432:5432 --name postgres postgres:9.3
47- docker exec postgres createdb -U postgres deis 2> /dev/null || true
48- @echo " To use postgres for local development:"
49- @echo " export DEIS_DATABASE_SERVICE_HOST=` docker-machine ip $$ (docker-machine active) 2> /dev/null || echo 127.0.0.1` "
50- @echo " export DEIS_DATABASE_SERVICE_PORT=5432"
51- @echo " export DEIS_DATABASE_USER=postgres"
52-
53- setup-venv :
54- python3 -m venv venv
55- venv/bin/pip3 install --disable-pip-version-check -q -r rootfs/requirements.txt -r rootfs/dev_requirements.txt
56-
57- test : test-style test-check test-unit test-functional
48+ test : test-style test-unit test-functional
5849
59- test-check :
60- cd rootfs && python manage.py check
61-
62- test-style :
63- cd rootfs && flake8 --show-source
50+ test-style : docker-build-test
51+ docker run -v ${CURDIR} :/test -w /test/rootfs ${IMAGE} .test /test/rootfs/bin/test-style
6452 ${SHELLCHECK_PREFIX} $(SHELL_SCRIPTS )
6553
66- test-unit :
67- cd rootfs \
68- && coverage run manage.py test --settings=api.settings.testing --noinput registry api scheduler.tests \
69- && coverage report -m
54+ test-unit : docker-build-test
55+ docker run -v ${CURDIR} :/test -w /test/rootfs ${IMAGE} .test /test/rootfs/bin/test-unit
7056
7157test-functional :
7258 @echo " Implement functional tests in _tests directory"
7359
7460test-integration :
7561 @echo " Check https://github.com/deis/workflow-e2e for the complete integration test suite"
7662
77- .PHONY : build clean commit-hook full-clean postgres setup-venv test test-style test-unit test-functional
63+ upload-coverage :
64+ $(eval CI_ENV := $(shell curl -s https://codecov.io/env | bash) )
65+ docker run ${CI_ENV} -v ${CURDIR} :/test -w /test/rootfs ${IMAGE} .test codecov --required
66+
67+ .PHONY : check-kubectl check-docker build docker-build docker-build-test deploy clean commit-hook full-clean test test-style test-unit test-functional test-integration upload-coverage
0 commit comments