From e9cddda89866e1ee594780c121bf7b3d2d110f8d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Thu, 14 Jun 2018 13:20:48 -0400 Subject: [PATCH] Always run coverage If you do not always run coverage, how will you know what the coverage is? Also remove some duplication in the environment setup. --- .circleci/config.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e6b594ac..258576048 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -50,7 +50,6 @@ jobs: - run: name: "Bootstrap test environment" - working_directory: "/tmp" command: | # Avoid the /nonexistent home directory in nobody's /etc/passwd # entry. @@ -75,10 +74,16 @@ jobs: virtualenv \ ${EXTRA_PACKAGES} + - run: &SETUP_VIRTUALENV + name: "Setup virtualenv" + # pip cannot install packages if the working directory is not + # readable. + working_directory: "/tmp" + command: | # Set up the virtualenv as a non-root user so we can run the test # suite as a non-root user. See below. sudo --set-home -u nobody virtualenv --python python2.7 /tmp/tests - sudo --set-home -u nobody /tmp/tests/bin/pip install tox + sudo --set-home -u nobody /tmp/tests/bin/pip install tox codecov - run: &RUN_TESTS name: "Run test suite" @@ -90,13 +95,18 @@ jobs: # Also run with /tmp as a workdir because the non-root user won't # be able to create the tox working filesystem state in the source # checkout because it is owned by root. - sudo --set-home -u nobody /tmp/tests/bin/tox -c /tmp/project/tox.ini --workdir /tmp -e py27 + sudo --set-home -u nobody /tmp/tests/bin/tox -c /tmp/project/tox.ini --workdir /tmp -e coverage - store_artifacts: &STORE_ARTIFACTS # Despite passing --workdir /tmp to tox above, it still runs trial # in the project source checkout. path: "/tmp/project/_trial_temp/test.log" + - run: + name: "Submit coverage results" + command: | + /tmp/tests/bin/codecov + debian-9: docker: @@ -166,11 +176,7 @@ jobs: yum install --assumeyes \ net-tools - # Set up the virtualenv as a non-root user so we can run the test - # suite as a non-root user. See below. - sudo -u nobody virtualenv --python python2.7 /tmp/tests - sudo -u nobody /tmp/tests/bin/pip install tox - + - run: *SETUP_VIRTUALENV - run: *RUN_TESTS