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:
|
|
|
|
build:
|
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/Dockerfile .
|
2017-12-13 20:52:16 +01:00
|
|
|
- image: gregprice/circleci:trusty-python-3.test
|
2017-08-30 02:09:09 +02:00
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: create cache directories
|
|
|
|
command: |
|
|
|
|
dirs=(/srv/zulip-{npm,venv}-cache)
|
|
|
|
sudo mkdir -p "${dirs[@]}"
|
|
|
|
sudo chown -R circleci "${dirs[@]}"
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2017-12-02 00:56:07 +01:00
|
|
|
- v1-node-base2
|
2017-08-30 02:09:09 +02:00
|
|
|
- v1-node-base1
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2017-12-02 00:56:07 +01:00
|
|
|
- v1-venv-base2
|
2017-08-30 02:09:09 +02:00
|
|
|
- v1-venv-base1
|
|
|
|
|
|
|
|
- run:
|
|
|
|
name: install dependencies
|
|
|
|
command: |
|
|
|
|
# Install moreutils so we can use `ts` and `mispipe` in the following.
|
|
|
|
sudo apt-get install -y moreutils
|
|
|
|
|
|
|
|
# TODO: Install and use codecov.
|
|
|
|
|
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
|
2017-12-02 00:56:07 +01:00
|
|
|
key: v1-node-base2
|
2017-08-30 02:09:09 +02:00
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-venv-cache
|
2017-12-02 00:56:07 +01:00
|
|
|
key: v1-venv-base2
|
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
|
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
# - store_artifacts: # TODO
|
|
|
|
# path: var/casper/
|
|
|
|
# # also /tmp/zulip-test-event-log/
|
|
|
|
# destination: test-reports
|
|
|
|
|
|
|
|
# TODO: notify zulipbot
|