From cb851283044c05e3f8da6795ef3ded353ebbcbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Arnauts?= Date: Thu, 5 Jan 2017 09:45:14 +0100 Subject: [PATCH] Speeds up lint and test in docker by keeping the cache between invocations. (#5177) * Add a volume to store the tox cache on the host. This gives quite some speed boost when running lint_docker and test_docker. * Only map .tox directory for cache. --- script/lint | 2 ++ script/lint_docker | 7 ++++++- script/test | 4 +++- script/test_docker | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/script/lint b/script/lint index 624ff0e5093..ab7561b9a5b 100755 --- a/script/lint +++ b/script/lint @@ -1,6 +1,8 @@ #!/bin/sh # Execute lint to spot code mistakes. +cd "$(dirname "$0")/.." + if [ "$1" = "--changed" ]; then export files="`git diff upstream/dev --name-only | grep -e '\.py$'`" echo "=================================================" diff --git a/script/lint_docker b/script/lint_docker index dca877d49ff..7e6ff42e074 100755 --- a/script/lint_docker +++ b/script/lint_docker @@ -4,5 +4,10 @@ # Stop on errors set -e +cd "$(dirname "$0")/.." + docker build -t home-assistant-test -f virtualization/Docker/Dockerfile.dev . -docker run --rm -it home-assistant-test tox -e lint +docker run --rm \ + -v `pwd`/.tox/:/usr/src/app/.tox/ \ + -t -i home-assistant-test \ + tox -e lint diff --git a/script/test b/script/test index 7aca00421b3..2f3f3557094 100755 --- a/script/test +++ b/script/test @@ -1,4 +1,6 @@ #!/bin/sh -# Excutes the tests with tox. +# Executes the tests with tox. + +cd "$(dirname "$0")/.." tox -e py34 diff --git a/script/test_docker b/script/test_docker index 78b4247857b..75b7cddf970 100755 --- a/script/test_docker +++ b/script/test_docker @@ -1,8 +1,13 @@ #!/bin/sh -# Excutes the tests with tox in a docker container. +# Executes the tests with tox in a docker container. # Stop on errors set -e +cd "$(dirname "$0")/.." + docker build -t home-assistant-test -f virtualization/Docker/Dockerfile.dev . -docker run --rm -it home-assistant-test tox -e py35 +docker run --rm \ + -v `pwd`/.tox/:/usr/src/app/.tox/ \ + -t -i home-assistant-test \ + tox -e py35