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:
|
2020-04-04 04:28:03 +02:00
|
|
|
- v1-venv-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements/thumbor-dev.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
|
2020-04-20 18:44:41 +02:00
|
|
|
key: v1-venv-base.{{ .Environment.CIRCLE_JOB }}-{{ checksum "requirements/thumbor-dev.txt" }}-{{ checksum "requirements/dev.txt" }}
|
2018-12-05 17:30:08 +01:00
|
|
|
# TODO: in Travis we also cache ~/zulip-emoji-cache, ~/node, ~/misc
|
|
|
|
|
2020-04-20 20:19:12 +02:00
|
|
|
- &do_bionic_hack
|
|
|
|
run:
|
|
|
|
name: do Bionic hack
|
|
|
|
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
|
|
|
|
sudo sed -i '/^bind/s/bind.*/bind 0.0.0.0/' /etc/redis/redis.conf
|
|
|
|
|
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."
|
|
|
|
|
2020-04-28 16:21:48 +02:00
|
|
|
- &build_production
|
2020-04-20 20:19:12 +02:00
|
|
|
run:
|
2020-04-28 16:21:48 +02:00
|
|
|
name: build production
|
2020-04-20 20:19:12 +02:00
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
|
|
|
# Install moreutils so we can use `ts` and `mispipe` in the following.
|
|
|
|
sudo apt-get install -y moreutils
|
|
|
|
|
2020-04-28 16:17:12 +02:00
|
|
|
mispipe ./tools/ci/production-build ts
|
2020-04-20 20:19:12 +02:00
|
|
|
|
2020-04-25 16:57:04 +02:00
|
|
|
- &production_extract_tarball
|
2020-04-20 20:19:12 +02:00
|
|
|
run:
|
2020-04-25 16:57:04 +02:00
|
|
|
name: production extract tarball
|
2020-04-20 20:19:12 +02:00
|
|
|
command: |
|
2020-04-23 08:17:30 +02:00
|
|
|
sudo apt-get update
|
|
|
|
# Install moreutils so we can use `ts` and `mispipe` in the following.
|
|
|
|
sudo apt-get install -y moreutils
|
|
|
|
|
2020-04-25 16:57:04 +02:00
|
|
|
mispipe /tmp/production-extract-tarball ts
|
|
|
|
|
|
|
|
- &install_production
|
|
|
|
run:
|
|
|
|
name: install production
|
|
|
|
command: |
|
2020-04-23 08:17:30 +02:00
|
|
|
sudo service rabbitmq-server restart
|
2020-04-24 07:09:38 +02:00
|
|
|
mispipe /tmp/production ts
|
2020-04-20 20:19:12 +02:00
|
|
|
|
2020-04-22 23:08:14 +02:00
|
|
|
- &check_xenial_provision_error
|
|
|
|
run:
|
|
|
|
name: check tools/provision error message on xenial
|
|
|
|
command: |
|
|
|
|
! tools/provision > >(tee provision.out)
|
|
|
|
grep -Fqx 'CRITICAL:root:Unsupported platform: ubuntu 16.04' provision.out
|
|
|
|
|
|
|
|
- &check_xenial_upgrade_error
|
|
|
|
run:
|
|
|
|
name: check scripts/lib/upgrade-zulip-stage-2 error message on xenial
|
|
|
|
command: |
|
|
|
|
! sudo scripts/lib/upgrade-zulip-stage-2 2> >(tee upgrade.err >&2)
|
|
|
|
grep -Fq 'upgrade-zulip-stage-2: Unsupported platform: ubuntu 16.04' upgrade.err
|
|
|
|
|
2020-04-23 00:12:30 +02:00
|
|
|
- &check_xenial_puppet
|
|
|
|
run:
|
|
|
|
name: check scripts/zulip-puppet-apply on xenial
|
|
|
|
command: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get -qy install lsb-release
|
|
|
|
sudo mkdir /etc/zulip
|
|
|
|
printf '[machine]\npuppet_classes = zulip::base, zulip::postgres_appdb_tuned\n' | sudo tee /etc/zulip/zulip.conf
|
|
|
|
sudo scripts/zulip-puppet-apply -f
|
2020-04-24 02:01:10 +02:00
|
|
|
sudo python3 -m py_compile /usr/local/bin/pg_backup_and_purge /usr/local/bin/process_fts_updates
|
2020-04-23 00:12:30 +02:00
|
|
|
|
2017-08-30 02:09:09 +02:00
|
|
|
jobs:
|
2020-04-17 19:19:26 +02:00
|
|
|
"bionic-backend-frontend-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.
|
2020-04-25 16:28:01 +02:00
|
|
|
- image: amanagr/circleci:bionic-python-2.test
|
2018-05-30 18:46:08 +02:00
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
2018-12-05 16:46:25 +01:00
|
|
|
- *create_cache_directories
|
2020-04-20 20:19:12 +02:00
|
|
|
- *do_bionic_hack
|
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
|
2020-04-23 00:02:18 +02:00
|
|
|
|
|
|
|
- run:
|
|
|
|
name: test locked requirements
|
|
|
|
command: |
|
|
|
|
. /srv/zulip-py3-venv/bin/activate
|
|
|
|
mispipe ./tools/test-locked-requirements ts
|
|
|
|
|
2020-04-17 19:19:26 +02:00
|
|
|
- *run_frontend_tests
|
|
|
|
# We only need to upload coverage reports on whichever platform
|
|
|
|
# runs the frontend tests.
|
|
|
|
- *upload_coverage_report
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: ./var/casper/
|
|
|
|
destination: casper
|
|
|
|
|
|
|
|
- store_artifacts:
|
|
|
|
path: ../../../tmp/zulip-test-event-log/
|
|
|
|
destination: test-reports
|
|
|
|
|
|
|
|
- store_test_results:
|
|
|
|
path: ./var/xunit-test-results/casper/
|
|
|
|
|
2018-05-30 18:46:08 +02:00
|
|
|
|
2020-04-23 00:03:20 +02:00
|
|
|
"focal-backend-python3.8":
|
2020-03-24 16:46:21 +01:00
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/focal/Dockerfile.
|
|
|
|
# Focal ships with Python 3.8.2.
|
|
|
|
- image: arpit551/circleci:focal-test
|
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- *create_cache_directories
|
|
|
|
- *restore_cache_package_json
|
|
|
|
- *restore_cache_requirements
|
|
|
|
- *install_dependencies
|
|
|
|
- *save_cache_package_json
|
|
|
|
- *save_cache_requirements
|
|
|
|
- *run_backend_tests
|
|
|
|
|
2020-04-23 00:12:30 +02:00
|
|
|
"xenial-legacy":
|
2020-04-22 23:08:14 +02:00
|
|
|
docker:
|
|
|
|
- image: gregprice/circleci:xenial-python-4.test
|
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- *check_xenial_provision_error
|
|
|
|
- *check_xenial_upgrade_error
|
2020-04-23 00:12:30 +02:00
|
|
|
- *check_xenial_puppet
|
2020-04-22 23:08:14 +02:00
|
|
|
|
2020-04-23 08:00:52 +02:00
|
|
|
"bionic-production-build-python3.6":
|
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/bionic/Dockerfile .
|
|
|
|
# Bionic ships with Python 3.6.
|
2020-04-25 16:28:01 +02:00
|
|
|
- image: amanagr/circleci:bionic-python-2.test
|
2020-04-23 08:00:52 +02:00
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
- *create_cache_directories
|
|
|
|
- *do_bionic_hack
|
|
|
|
- *restore_cache_package_json
|
|
|
|
- *restore_cache_requirements
|
2020-04-28 16:21:48 +02:00
|
|
|
- *build_production
|
2020-04-23 08:00:52 +02:00
|
|
|
- *save_cache_package_json
|
|
|
|
- *save_cache_requirements
|
|
|
|
|
|
|
|
# Persist the built tarball to be used in downstream job
|
|
|
|
# for installation of production server.
|
|
|
|
# See https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
|
|
|
- persist_to_workspace:
|
|
|
|
# Must be an absolute path,
|
|
|
|
# or relative path from working_directory.
|
|
|
|
# This is a directory on the container which is
|
|
|
|
# taken to be the root directory of the workspace.
|
|
|
|
root: /tmp
|
|
|
|
# Must be relative path from root
|
|
|
|
paths:
|
|
|
|
- zulip-server-test.tar.gz
|
2020-04-23 13:46:39 +02:00
|
|
|
- success-http-headers.txt
|
2020-04-28 16:24:29 +02:00
|
|
|
- production-install
|
2020-04-24 07:09:38 +02:00
|
|
|
- production
|
2020-04-25 16:57:04 +02:00
|
|
|
- production-extract-tarball
|
2020-04-23 08:00:52 +02:00
|
|
|
|
2020-04-23 08:17:30 +02:00
|
|
|
"bionic-production-install-python3.6":
|
|
|
|
docker:
|
|
|
|
# This is built from tools/circleci/images/bionic/Dockerfile .
|
|
|
|
# Bionic ships with Python 3.6.
|
2020-04-25 16:28:01 +02:00
|
|
|
- image: amanagr/circleci:bionic-python-2.test
|
2020-04-23 08:17:30 +02:00
|
|
|
|
|
|
|
working_directory: ~/zulip
|
|
|
|
|
|
|
|
steps:
|
|
|
|
# Contains the built tarball from bionic-production-build-python3.6 job
|
|
|
|
- attach_workspace:
|
|
|
|
# Must be absolute path or relative path from working_directory
|
|
|
|
at: /tmp
|
|
|
|
|
|
|
|
- *create_cache_directories
|
|
|
|
- *do_bionic_hack
|
2020-04-25 16:57:04 +02:00
|
|
|
- *production_extract_tarball
|
2020-04-23 08:17:30 +02:00
|
|
|
- *restore_cache_package_json
|
2020-04-25 16:23:58 +02:00
|
|
|
- *install_production
|
|
|
|
- *save_cache_package_json
|
2020-04-23 08:17:30 +02:00
|
|
|
|
2018-01-30 21:20:50 +01:00
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
2020-04-17 19:19:26 +02:00
|
|
|
- "bionic-backend-frontend-python3.6"
|
2020-04-23 08:39:02 +02:00
|
|
|
- "bionic-production-build-python3.6"
|
2020-04-23 00:03:20 +02:00
|
|
|
- "focal-backend-python3.8"
|
2020-04-23 00:12:30 +02:00
|
|
|
- "xenial-legacy"
|
2020-04-23 08:39:02 +02:00
|
|
|
- "bionic-production-install-python3.6":
|
|
|
|
requires:
|
|
|
|
- "bionic-production-build-python3.6"
|