From 57d2d3ada599adc2103627122ab8d992e5e77c17 Mon Sep 17 00:00:00 2001 From: Vishnu Ks Date: Sat, 27 Jan 2018 01:38:13 +0530 Subject: [PATCH] circleci: Upload coverage reports to codecov.io. The Travis config does this by a `pip install codecov` in setup and running the resulting `codecov` command at the end. That risks confusion because it makes the library look like something we might be using *during* the tests to collect coverage information. Instead, install and run codecov together at the end. (The docs also suggest using their bash-based uploader instead; but following those directions seems to result in coverage.xml not getting included (maybe not even built), and no coverage data getting uploaded for Python source files, only JavaScript. Not sure why that is, but using the pip package is fine.) Also, because this step is inherently about talking to a third-party service whose reliability we can't control, and because it's purely a reporting step that happens after our actual test suite has succeeded, don't fail if it fails; just print a message. (I'd prefer a somewhat louder message, like turning that step yellow or something in the Circle web UI, but Circle doesn't offer an option like that. If the coverage reports start consistently failing for some reason, then if we're actually reading them we'll notice anyway.) [greg: Edited step name and error message; wrote this commit message.] --- .circleci/config.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c4237e0a6..32db9a522d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,8 +34,6 @@ jobs: # Install moreutils so we can use `ts` and `mispipe` in the following. sudo apt-get install -y moreutils - # TODO: Install and use codecov. - # CircleCI sets the following in Git config at clone time: # url.ssh://git@github.com.insteadOf https://github.com # This breaks the Git clones in the NVM `install.sh` we run @@ -75,6 +73,13 @@ jobs: . /srv/zulip-py3-venv/bin/activate mispipe ./tools/travis/frontend ts + - run: + name: upload coverage report + command: | + . /srv/zulip-py3-venv/bin/activate + pip install codecov && codecov \ + || echo "Error in uploading coverage reports to codecov.io." + # - store_artifacts: # TODO # path: var/casper/ # # also /tmp/zulip-test-event-log/