2018-12-28 09:21:03 +01:00
|
|
|
# See https://zulip.readthedocs.io/en/latest/testing/continuous-integration.html for
|
|
|
|
# high-level documentation on our CircleCI setup.
|
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/
|
|
|
|
#
|
2019-04-10 11:09:12 +02:00
|
|
|
version: 2.0
|
2018-12-05 16:46:25 +01:00
|
|
|
aliases:
|
|
|
|
- &create_cache_directories
|
|
|
|
run:
|
|
|
|
name: create cache directories
|
|
|
|
command: |
|
|
|
|
dirs=(/srv/zulip-{npm,venv}-cache)
|
|
|
|
sudo mkdir -p "${dirs[@]}"
|
|
|
|
sudo chown -R circleci "${dirs[@]}"
|
|
|
|
|
2018-12-05 17:24:51 +01:00
|
|
|
- &restore_cache_package_json
|
|
|
|
restore_cache:
|
|
|
|
keys:
|
2018-12-05 17:24:51 +01:00
|
|
|
- v1-npm-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2018-12-05 17:24:51 +01:00
|
|
|
|
|
|
|
- &restore_cache_requirements
|
|
|
|
restore_cache:
|
|
|
|
keys:
|
2018-12-05 17:24:51 +01:00
|
|
|
- v1-venv-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2018-12-05 17:24:51 +01:00
|
|
|
|
2018-12-05 16:53:07 +01:00
|
|
|
- &install_dependencies
|
|
|
|
run:
|
|
|
|
name: install dependencies
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
2018-12-05 21:33:41 +01:00
|
|
|
# Install moreutils so we can use `ts` and `mispipe` in the following.
|
2018-12-05 16:53:07 +01:00
|
|
|
sudo apt-get install -y moreutils
|
2018-12-05 21:33:41 +01: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?)
|
2018-12-05 16:53:07 +01:00
|
|
|
rm -f /home/circleci/.gitconfig
|
2018-12-05 21:33:41 +01:00
|
|
|
|
|
|
|
# This is the main setup job for the test suite
|
2018-12-10 08:05:16 +01:00
|
|
|
mispipe "tools/ci/setup-backend" ts
|
2018-12-05 16:53:07 +01:00
|
|
|
|
2018-12-05 21:33:41 +01:00
|
|
|
# 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
|
|
|
|
|
2018-12-05 17:30:08 +01:00
|
|
|
- &save_cache_package_json
|
|
|
|
save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-npm-cache
|
2018-12-05 17:24:51 +01:00
|
|
|
key: v1-npm-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "package.json" }}-{{ checksum "yarn.lock" }}
|
2018-12-05 17:30:08 +01:00
|
|
|
|
|
|
|
- &save_cache_requirements
|
|
|
|
save_cache:
|
|
|
|
paths:
|
|
|
|
- /srv/zulip-venv-cache
|
2018-12-05 17:24:51 +01:00
|
|
|
key: v1-venv-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements/thumbor.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2018-12-05 17:30:08 +01:00
|
|
|
# TODO: in Travis we also cache ~/zulip-emoji-cache, ~/node, ~/misc
|
|
|
|
|
2018-12-05 16:55:08 +01:00
|
|
|
- &run_backend_tests
|
|
|
|
run:
|
|
|
|
name: run backend tests
|
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
2018-12-10 08:05:16 +01:00
|
|
|
mispipe ./tools/ci/backend ts
|
2018-12-05 16:55:08 +01:00
|
|
|
|
2018-12-05 16:58:41 +01:00
|
|
|
- &run_frontend_tests
|
|
|
|
run:
|
|
|
|
name: run frontend tests
|
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
2018-12-10 08:05:16 +01:00
|
|
|
mispipe ./tools/ci/frontend ts
|
2018-12-05 16:58:41 +01:00
|
|
|
|
2018-12-05 17:00:55 +01:00
|
|
|
- &upload_coverage_report
|
|
|
|
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
|
|
|
jobs:
|
2019-05-25 02:07:16 +02:00
|
|
|
"xenial-backend-frontend-python3.5":
|
2018-01-30 21:20:50 +01:00
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/xenial/Dockerfile .
|
2019-04-02 10:51:35 +02:00
|
|
|
# Xenial ships with Python 3.5.
|
2018-06-02 01:24:21 +02:00
|
|
|
- image: gregprice/circleci:xenial-python-4.test
|
2018-01-30 21:20:50 +01:00
|
|
|
|
2018-01-30 21:21:29 +01:00
|
|
|
working_directory: ~/zulip
|
2018-01-30 21:20:50 +01:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
2019-05-25 02:07:16 +02:00
|
|
|
|
2018-12-05 16:46:25 +01:00
|
|
|
- *create_cache_directories
|
2018-12-05 17:24:51 +01:00
|
|
|
- *restore_cache_package_json
|
|
|
|
- *restore_cache_requirements
|
2018-12-05 16:53:07 +01:00
|
|
|
- *install_dependencies
|
2018-12-05 17:30:08 +01:00
|
|
|
- *save_cache_package_json
|
|
|
|
- *save_cache_requirements
|
2018-12-05 16:55:08 +01:00
|
|
|
- *run_backend_tests
|
2019-05-25 02:07:16 +02:00
|
|
|
- *run_frontend_tests
|
|
|
|
# We only need to upload coverage reports on whichever platform
|
|
|
|
# runs the frontend tests.
|
|
|
|
- *upload_coverage_report
|
|
|
|
|
|
|
|
# - store_artifacts: # TODO
|
|
|
|
# path: var/casper/
|
|
|
|
# # also /tmp/zulip-test-event-log/
|
|
|
|
# destination: test-reports
|
2018-01-31 18:41:05 +01:00
|
|
|
|
2019-04-10 11:09:12 +02:00
|
|
|
"bionic-backend-python3.6":
|
2018-05-30 18:46:08 +02:00
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/bionic/Dockerfile .
|
2019-04-02 10:51:35 +02:00
|
|
|
# Bionic ships with Python 3.6.
|
2018-05-30 18:46:08 +02:00
|
|
|
- image: gregprice/circleci:bionic-python-1.test
|
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2018-12-05 16:46:25 +01:00
|
|
|
- *create_cache_directories
|
|
|
|
|
2018-05-30 18:46:08 +02:00
|
|
|
- run:
|
2018-12-05 16:46:25 +01:00
|
|
|
name: do Bionic hack
|
2018-05-30 18:46:08 +02:00
|
|
|
command: |
|
|
|
|
# Temporary hack till `sudo service redis-server start` gets fixes in Bionic. See
|
|
|
|
# https://chat.zulip.org/#narrow/stream/3-backend/topic/Ubuntu.20bionic.20CircleCI
|
2019-05-03 16:21:19 +02:00
|
|
|
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf
|
2018-05-30 18:46:08 +02:00
|
|
|
|
2018-12-05 17:24:51 +01:00
|
|
|
- *restore_cache_package_json
|
|
|
|
- *restore_cache_requirements
|
2018-12-05 16:53:07 +01:00
|
|
|
- *install_dependencies
|
2018-12-05 17:30:08 +01:00
|
|
|
- *save_cache_package_json
|
|
|
|
- *save_cache_requirements
|
2018-12-05 16:55:08 +01:00
|
|
|
- *run_backend_tests
|
2018-05-30 18:46:08 +02:00
|
|
|
|
2018-01-30 21:20:50 +01:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
2019-05-25 02:07:16 +02:00
|
|
|
- "xenial-backend-frontend-python3.5"
|
2019-04-10 11:09:12 +02:00
|
|
|
- "bionic-backend-python3.6"
|