2017-08-30 02:09:09 +02:00
|
|
|
# See CircleCI upstream's docs on this config format:
|
|
|
|
# https://circleci.com/docs/2.0/language-python/
|
|
|
|
#
|
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-01-30 21:20:50 +01:00
|
|
|
"trusty-python-3.4":
|
2017-08-30 02:09:09 +02:00
|
|
|
docker:
|
2018-01-30 21:20:50 +01:00
|
|
|
# This is built from tools/circleci/images/trusty/Dockerfile .
|
2018-01-31 19:50:36 +01:00
|
|
|
- image: gregprice/circleci:trusty-python-4.test
|
2017-08-30 02:09:09 +02:00
|
|
|
|
2018-01-30 21:21:29 +01:00
|
|
|
working_directory: ~/zulip
|
2017-08-30 02:09:09 +02:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: create cache directories
|
|
|
|
command: |
|
|
|
|
dirs=(/srv/zulip-{npm,venv}-cache)
|
|
|
|
sudo mkdir -p "${dirs[@]}"
|
|
|
|
sudo chown -R circleci "${dirs[@]}"
|
2018-04-12 18:46:40 +02:00
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2018-03-31 22:41:06 +02:00
|
|
|
- v1-npm-base.trusty-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2017-08-30 02:09:09 +02:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2018-03-31 22:41:06 +02:00
|
|
|
- v1-venv-base.trusty-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2017-08-30 02:09:09 +02:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: install dependencies
|
|
|
|
command: |
|
|
|
|
# Install moreutils so we can use `ts` and `mispipe` in the following.
|
|
|
|
sudo apt-get install -y moreutils
|
|
|
|
|
2017-09-20 02:36:30 +02:00
|
|
|
# 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
|
|
|
|
# in `install-node`.
|
|
|
|
# TODO: figure out why that breaks, and whether we want it.
|
|
|
|
# (Is it an optimization?)
|
|
|
|
rm -f /home/circleci/.gitconfig
|
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
# This is the main setup job for the test suite
|
|
|
|
mispipe "tools/travis/setup-backend" ts
|
|
|
|
|
|
|
|
# Cleaning caches is mostly unnecessary in Circle, because
|
|
|
|
# most builds don't get to write to the cache.
|
|
|
|
# mispipe "scripts/lib/clean-unused-caches --verbose --threshold 0" ts
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-npm-cache
|
2018-03-31 22:41:06 +02:00
|
|
|
key: v1-npm-base.trusty-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2017-08-30 02:09:09 +02:00
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-venv-cache
|
2018-03-31 22:41:06 +02:00
|
|
|
key: v1-venv-base.trusty-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2017-08-30 02:09:09 +02:00
|
|
|
# TODO: in Travis we also cache ~/zulip-emoji-cache, ~/node, ~/misc
|
|
|
|
|
2018-01-05 12:11:11 +01:00
|
|
|
# The moment of truth! Run the tests.
|
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
- run:
|
2018-01-05 12:11:11 +01:00
|
|
|
name: run backend tests
|
2017-08-30 02:09:09 +02:00
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
|
|
|
mispipe ./tools/travis/backend ts
|
|
|
|
|
2018-01-05 12:11:11 +01:00
|
|
|
- run:
|
|
|
|
name: run frontend tests
|
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
|
|
|
mispipe ./tools/travis/frontend ts
|
|
|
|
|
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.]
2018-01-26 21:08:13 +01:00
|
|
|
- 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."
|
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
# - store_artifacts: # TODO
|
|
|
|
# path: var/casper/
|
|
|
|
# # also /tmp/zulip-test-event-log/
|
|
|
|
# destination: test-reports
|
|
|
|
|
2018-01-30 21:20:50 +01:00
|
|
|
"xenial-python-3.5":
|
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/xenial/Dockerfile .
|
|
|
|
- image: gregprice/circleci:xenial-python-3.test
|
|
|
|
|
2018-01-30 21:21:29 +01:00
|
|
|
working_directory: ~/zulip
|
2018-01-30 21:20:50 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: create cache directories
|
|
|
|
command: |
|
|
|
|
dirs=(/srv/zulip-{npm,venv}-cache)
|
|
|
|
sudo mkdir -p "${dirs[@]}"
|
|
|
|
sudo chown -R circleci "${dirs[@]}"
|
2018-04-04 20:06:41 +02:00
|
|
|
|
2018-01-30 21:20:50 +01:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2018-03-31 22:41:06 +02:00
|
|
|
- v1-npm-base.xenial-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2018-01-30 21:20:50 +01:00
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2018-03-31 22:41:06 +02:00
|
|
|
- v1-venv-base.xenial-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2018-01-30 21:20:50 +01:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: install dependencies
|
|
|
|
command: |
|
2018-05-10 23:27:35 +02:00
|
|
|
sudo apt-get update
|
2018-01-30 21:20:50 +01:00
|
|
|
sudo apt-get install -y moreutils
|
|
|
|
rm -f /home/circleci/.gitconfig
|
|
|
|
mispipe "tools/travis/setup-backend" ts
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-npm-cache
|
2018-03-31 22:41:06 +02:00
|
|
|
key: v1-npm-base.xenial-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2018-01-30 21:20:50 +01:00
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-venv-cache
|
2018-03-31 22:41:06 +02:00
|
|
|
key: v1-venv-base.xenial-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2018-01-30 21:20:50 +01:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: run backend tests
|
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
|
|
|
mispipe ./tools/travis/backend ts
|
|
|
|
|
2018-01-31 18:41:05 +01:00
|
|
|
- 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."
|
|
|
|
|
2018-01-30 21:20:50 +01:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
|
|
|
- "trusty-python-3.4"
|
|
|
|
- "xenial-python-3.5"
|