From 5a5f28228a44975899a1b2787ac4b9ad72b74bea Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 25 Aug 2015 10:53:31 -0400 Subject: [PATCH 1/2] Document installing of pre-commit hooks. Signed-off-by: Daniel Nephin --- CONTRIBUTING.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9188ac98a..9ff8304c76 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -30,6 +30,17 @@ that should get you started. `docker-compose` from anywhere on your machine, it will run your development version of Compose. +## Install pre-commit hooks + +This step is optional, but recommended. Pre-commit hooks will run style checks +and in some cases fix style issues for you, when you commit code. + +Install the git pre-commit hooks using [tox](https://tox.readthedocs.org) by +running `tox -e pre-commit` or by following the +[pre-commit install guide](http://pre-commit.com/#install). + +To run the style checks at any time run `tox -e pre-commit`. + ## Submitting a pull request See Docker's [basic contribution workflow](https://docs.docker.com/project/make-a-contribution/#the-basic-contribution-workflow) for a guide on how to submit a pull request for code or documentation. From 74782a56b53638431c93f0081e8d933f7fc0a104 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 25 Aug 2015 10:57:21 -0400 Subject: [PATCH 2/2] Fix script/test by just calling script/test-versions directly instead of launching another container. Signed-off-by: Daniel Nephin --- script/ci | 1 + script/test | 15 +++++---------- script/test-versions | 5 ++++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/script/ci b/script/ci index b497548781..e8356bb73f 100755 --- a/script/ci +++ b/script/ci @@ -10,6 +10,7 @@ set -e export DOCKER_VERSIONS=all export DOCKER_DAEMON_ARGS="--storage-driver=overlay" +GIT_VOLUME="--volumes-from=$(hostname)" . script/test-versions >&2 echo "Building Linux binary" diff --git a/script/test b/script/test index adf3fb1bab..bdb3579b01 100755 --- a/script/test +++ b/script/test @@ -6,15 +6,10 @@ set -ex TAG="docker-compose:$(git rev-parse --short HEAD)" rm -rf coverage-html +# Create the host directory so it's owned by $USER +mkdir -p coverage-html docker build -t "$TAG" . -docker run \ - --rm \ - --volume="/var/run/docker.sock:/var/run/docker.sock" \ - -e DOCKER_VERSIONS \ - -e "TAG=$TAG" \ - -e "affinity:image==$TAG" \ - -e "COVERAGE_DIR=$(pwd)/coverage-html" \ - --entrypoint="script/test-versions" \ - "$TAG" \ - "$@" + +GIT_VOLUME="--volume=$(pwd)/.git:/code/.git" +. script/test-versions diff --git a/script/test-versions b/script/test-versions index f39c17e819..88d2554c2b 100755 --- a/script/test-versions +++ b/script/test-versions @@ -5,7 +5,10 @@ set -e >&2 echo "Running lint checks" -tox -e pre-commit +docker run --rm \ + ${GIT_VOLUME} \ + --entrypoint="tox" \ + "$TAG" -e pre-commit if [ "$DOCKER_VERSIONS" == "" ]; then DOCKER_VERSIONS="default"