2016-12-15 01:26:55 +03:00
|
|
|
dist: trusty
|
2013-06-25 18:00:48 +04:00
|
|
|
env:
|
2013-06-25 21:05:18 +04:00
|
|
|
global:
|
2016-06-29 13:25:38 +03:00
|
|
|
- BROKER_URL='amqp://guest:guest@localhost:5672//'
|
2015-09-16 15:00:34 +03:00
|
|
|
- DATABASE_URL='mysql://root@localhost/test_treeherder'
|
2016-06-29 13:25:38 +03:00
|
|
|
- ELASTICSEARCH_URL='http://127.0.0.1:9200'
|
2016-04-02 21:54:02 +03:00
|
|
|
- TREEHERDER_DJANGO_SECRET_KEY='secretkey-of-at-50-characters-to-pass-check-deploy'
|
2015-10-29 22:57:07 +03:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
# Each entry here creates another sub-job.
|
|
|
|
|
2016-05-04 20:03:00 +03:00
|
|
|
# Job 1: Linters
|
2016-11-04 02:36:57 +03:00
|
|
|
- env: python-linters
|
2015-10-29 23:04:33 +03:00
|
|
|
sudo: false
|
|
|
|
language: python
|
2016-12-26 05:06:08 +03:00
|
|
|
python: "2.7.13"
|
2015-10-29 23:04:33 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- ~/venv
|
|
|
|
before_install:
|
|
|
|
# Create a clean virtualenv rather than using the one given to us,
|
|
|
|
# to work around: https://github.com/travis-ci/travis-ci/issues/4873
|
2016-05-26 13:10:34 +03:00
|
|
|
- if [[ ! -f ~/venv/bin/activate ]]; then virtualenv -p python ~/venv; fi
|
2015-10-29 23:04:33 +03:00
|
|
|
- source ~/venv/bin/activate
|
2017-05-09 14:42:11 +03:00
|
|
|
- pip install --disable-pip-version-check --upgrade pip==9.0.1
|
2015-10-29 23:04:33 +03:00
|
|
|
install:
|
2016-01-20 19:22:54 +03:00
|
|
|
- pip install --disable-pip-version-check --require-hashes -r requirements/common.txt -r requirements/dev.txt
|
2015-10-29 23:04:33 +03:00
|
|
|
script:
|
2016-03-09 16:24:32 +03:00
|
|
|
- python lints/queuelint.py
|
2015-10-29 23:04:33 +03:00
|
|
|
- flake8 --show-source
|
|
|
|
- isort --check-only --diff --quiet
|
|
|
|
|
2016-05-04 20:03:00 +03:00
|
|
|
# Job 2: Nodejs UI tests
|
2015-10-29 23:20:32 +03:00
|
|
|
- env: ui-tests
|
|
|
|
sudo: false
|
|
|
|
language: node_js
|
2017-05-11 12:36:34 +03:00
|
|
|
node_js: "7.10.0"
|
2015-10-29 23:20:32 +03:00
|
|
|
cache:
|
|
|
|
# Note: This won't re-use the same cache as the linters job,
|
|
|
|
# since caches are tied to the language/version combination.
|
|
|
|
directories:
|
|
|
|
- node_modules
|
2016-12-29 23:14:48 +03:00
|
|
|
addons:
|
|
|
|
firefox: latest
|
2017-06-22 18:39:48 +03:00
|
|
|
before_install:
|
|
|
|
# Required due to: https://github.com/travis-ci/travis-ci/issues/7951
|
|
|
|
- curl -sSfL https://yarnpkg.com/install.sh | bash
|
|
|
|
- export PATH=$HOME/.yarn/bin:$PATH
|
2015-10-29 23:20:32 +03:00
|
|
|
install:
|
2017-03-11 02:12:14 +03:00
|
|
|
# `--frozen-lockfile` will catch cases where people have forgotten to update `yarn.lock`.
|
|
|
|
# `--no-bin-links` is only necessary on Windows hosts, but we include here to ensure
|
|
|
|
# that the package.json scripts aren't relying on symlinks that won't exist elsewhere.
|
|
|
|
- yarn install --frozen-lockfile --no-bin-links
|
2015-10-29 23:20:32 +03:00
|
|
|
before_script:
|
|
|
|
# Required for Karma tests (http://docs.travis-ci.com/user/gui-and-headless-browsers/)
|
|
|
|
- export DISPLAY=:99.0
|
|
|
|
- sh -e /etc/init.d/xvfb start
|
|
|
|
script:
|
2017-03-11 02:12:14 +03:00
|
|
|
- yarn test
|
2017-06-29 21:32:54 +03:00
|
|
|
- yarn build
|
2015-10-29 23:20:32 +03:00
|
|
|
|
2016-05-04 20:03:00 +03:00
|
|
|
# Job 3: Python Tests Chunk A
|
2015-10-30 00:48:07 +03:00
|
|
|
- env: python-tests-main
|
2016-12-15 01:21:10 +03:00
|
|
|
# TODO: Investigate switching back to the container infra, by setting `sudo: false`.
|
2015-10-29 22:57:07 +03:00
|
|
|
sudo: required
|
2015-10-29 23:26:03 +03:00
|
|
|
language: python
|
2016-12-26 05:06:08 +03:00
|
|
|
python: "2.7.13"
|
2016-05-04 20:05:19 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- ~/venv
|
2015-10-29 22:57:07 +03:00
|
|
|
services:
|
|
|
|
- rabbitmq
|
|
|
|
before_install:
|
2017-06-22 18:22:56 +03:00
|
|
|
- curl -sSo ~/elasticsearch.deb https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.1.deb && sudo dpkg -i --force-confold ~/elasticsearch.deb
|
|
|
|
- sudo service elasticsearch restart
|
2017-03-15 20:14:32 +03:00
|
|
|
- sudo cp vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf
|
2017-07-06 22:13:25 +03:00
|
|
|
- echo 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7' | sudo tee /etc/apt/sources.list.d/mysql.list > /dev/null
|
|
|
|
- sudo -E apt-get -yqq update
|
2017-07-07 02:05:40 +03:00
|
|
|
- sudo -E apt-get -yqq install --no-install-recommends --allow-unauthenticated mysql-server libmysqlclient-dev
|
2016-05-04 20:05:19 +03:00
|
|
|
# Create a clean virtualenv rather than using the one given to us,
|
|
|
|
# to work around: https://github.com/travis-ci/travis-ci/issues/4873
|
2016-05-26 13:10:34 +03:00
|
|
|
- if [[ ! -f ~/venv/bin/activate ]]; then virtualenv -p python ~/venv; fi
|
2016-05-04 20:05:19 +03:00
|
|
|
- source ~/venv/bin/activate
|
2017-05-09 14:42:11 +03:00
|
|
|
- pip install --disable-pip-version-check --upgrade pip==9.0.1
|
Bug 1285539 - Fix 'manage.py check --deploy' on Travis
The `manage.py check --deploy` command causes the Django models to be
initialised, which requires Elasticsearch to be accessible, if
`ELASTICSEARCH_URL` is set. The variable is set globally for the Travis
runs, however for the linters job (which is where `check --deploy` was
previously being run) Elasticsearch isn't actually installed.
Whilst we could have just unset `ELASTICSEARCH_URL` for the linters job,
it's best to move the test to the main Python job chunk, since:
* The command doesn't only hit Elasticsearch, but also the DB, and the
linters job is running the older mysql 5.5, rather than mysql 5.6.
* Whilst Elasticsearch isn't currently enabled for anywhere other than
the prototype Heroku instance, we'll soon be using it everywhere, so
should get `check --deploy` to actually test what we plan to deploy.
Note: The exception during `check --deploy` was not turning the Travis
run red, due to `check --deploy` being piped to awk. When we update to
Django 1.10 the awk workaround can be removed, however in the meantime
we can use the bash `pipefail` option to ensure the exit code from the
`manage.py` command propagates through to the one that Travis sees.
2016-07-11 17:08:59 +03:00
|
|
|
# Create the test database for `manage.py check --deploy`.
|
|
|
|
- mysql -u root -e 'create database test_treeherder;'
|
2015-10-29 22:57:07 +03:00
|
|
|
install:
|
2016-01-20 19:22:54 +03:00
|
|
|
- pip install --disable-pip-version-check --require-hashes -r requirements/common.txt -r requirements/dev.txt
|
2016-12-15 01:39:55 +03:00
|
|
|
before_script:
|
2017-04-19 15:44:46 +03:00
|
|
|
- while ! curl "$ELASTICSEARCH_URL" &> /dev/null; do sleep 1; done
|
2015-10-29 22:57:07 +03:00
|
|
|
script:
|
Bug 1285539 - Fix 'manage.py check --deploy' on Travis
The `manage.py check --deploy` command causes the Django models to be
initialised, which requires Elasticsearch to be accessible, if
`ELASTICSEARCH_URL` is set. The variable is set globally for the Travis
runs, however for the linters job (which is where `check --deploy` was
previously being run) Elasticsearch isn't actually installed.
Whilst we could have just unset `ELASTICSEARCH_URL` for the linters job,
it's best to move the test to the main Python job chunk, since:
* The command doesn't only hit Elasticsearch, but also the DB, and the
linters job is running the older mysql 5.5, rather than mysql 5.6.
* Whilst Elasticsearch isn't currently enabled for anywhere other than
the prototype Heroku instance, we'll soon be using it everywhere, so
should get `check --deploy` to actually test what we plan to deploy.
Note: The exception during `check --deploy` was not turning the Travis
run red, due to `check --deploy` being piped to awk. When we update to
Django 1.10 the awk workaround can be removed, however in the meantime
we can use the bash `pipefail` option to ensure the exit code from the
`manage.py` command propagates through to the one that Travis sees.
2016-07-11 17:08:59 +03:00
|
|
|
# Several security features in settings.py (eg setting HSTS headers) are conditional on
|
|
|
|
# 'https://' being in the site URL. In addition, we override the test environment's debug
|
|
|
|
# value so the tests pass. The real environment variable will be checked during deployment.
|
2017-01-05 02:54:25 +03:00
|
|
|
- SITE_URL='https://treeherder.dev' TREEHERDER_DEBUG='False' ./manage.py check --deploy --fail-level WARNING
|
2017-05-17 01:27:45 +03:00
|
|
|
- py.test tests/ --runslow --ignore=tests/e2e/ --ignore=tests/etl/ --ignore=tests/log_parser/ --ignore=tests/webapp/ --ignore=tests/selenium/ --ignore=tests/jenkins/
|
2015-11-11 15:41:44 +03:00
|
|
|
|
2016-05-04 20:03:00 +03:00
|
|
|
# Job 4: Python Tests Chunk B
|
2016-05-26 15:44:31 +03:00
|
|
|
- env: python-tests-e2e-etl-logparser
|
2016-12-15 01:21:10 +03:00
|
|
|
# TODO: Investigate switching back to the container infra, by setting `sudo: false`.
|
2015-10-30 00:48:07 +03:00
|
|
|
sudo: required
|
|
|
|
language: python
|
2016-12-26 05:06:08 +03:00
|
|
|
python: "2.7.13"
|
2016-05-04 20:05:19 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- ~/venv
|
2015-10-30 00:48:07 +03:00
|
|
|
services:
|
|
|
|
- rabbitmq
|
|
|
|
before_install:
|
2017-06-22 18:22:56 +03:00
|
|
|
- curl -sSo ~/elasticsearch.deb https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.1.deb && sudo dpkg -i --force-confold ~/elasticsearch.deb
|
|
|
|
- sudo service elasticsearch restart
|
2017-03-15 20:14:32 +03:00
|
|
|
- sudo cp vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf
|
2017-07-06 22:13:25 +03:00
|
|
|
- echo 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7' | sudo tee /etc/apt/sources.list.d/mysql.list > /dev/null
|
|
|
|
- sudo -E apt-get -yqq update
|
2017-07-07 02:05:40 +03:00
|
|
|
- sudo -E apt-get -yqq install --no-install-recommends --allow-unauthenticated mysql-server libmysqlclient-dev
|
2016-05-04 20:05:19 +03:00
|
|
|
# Create a clean virtualenv rather than using the one given to us,
|
|
|
|
# to work around: https://github.com/travis-ci/travis-ci/issues/4873
|
2016-05-26 13:10:34 +03:00
|
|
|
- if [[ ! -f ~/venv/bin/activate ]]; then virtualenv -p python ~/venv; fi
|
2016-05-04 20:05:19 +03:00
|
|
|
- source ~/venv/bin/activate
|
2017-05-09 14:42:11 +03:00
|
|
|
- pip install --disable-pip-version-check --upgrade pip==9.0.1
|
2015-10-30 00:48:07 +03:00
|
|
|
install:
|
2016-01-20 19:22:54 +03:00
|
|
|
- pip install --disable-pip-version-check --require-hashes -r requirements/common.txt -r requirements/dev.txt
|
2016-12-15 01:39:55 +03:00
|
|
|
before_script:
|
2017-04-19 15:44:46 +03:00
|
|
|
- while ! curl "$ELASTICSEARCH_URL" &> /dev/null; do sleep 1; done
|
2015-10-30 00:48:07 +03:00
|
|
|
script:
|
2015-11-11 15:41:44 +03:00
|
|
|
- py.test tests/e2e/ tests/etl/ tests/log_parser/ --runslow
|
2015-10-29 22:57:07 +03:00
|
|
|
|
2016-05-26 15:44:31 +03:00
|
|
|
# Job 5: Python Tests Chunk C
|
|
|
|
- env: python-tests-webapp
|
2016-12-15 01:21:10 +03:00
|
|
|
# TODO: Investigate switching back to the container infra, by setting `sudo: false`.
|
2016-05-26 15:44:31 +03:00
|
|
|
sudo: required
|
|
|
|
language: python
|
2016-12-26 05:06:08 +03:00
|
|
|
python: "2.7.13"
|
2016-05-26 15:44:31 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- ~/venv
|
|
|
|
services:
|
|
|
|
- rabbitmq
|
|
|
|
before_install:
|
2017-06-22 18:22:56 +03:00
|
|
|
- curl -sSo ~/elasticsearch.deb https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.1.deb && sudo dpkg -i --force-confold ~/elasticsearch.deb
|
|
|
|
- sudo service elasticsearch restart
|
2017-03-15 20:14:32 +03:00
|
|
|
- sudo cp vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf
|
2017-07-06 22:13:25 +03:00
|
|
|
- echo 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7' | sudo tee /etc/apt/sources.list.d/mysql.list > /dev/null
|
|
|
|
- sudo -E apt-get -yqq update
|
2017-07-07 02:05:40 +03:00
|
|
|
- sudo -E apt-get -yqq install --no-install-recommends --allow-unauthenticated mysql-server libmysqlclient-dev
|
2016-05-26 15:44:31 +03:00
|
|
|
# Create a clean virtualenv rather than using the one given to us,
|
|
|
|
# to work around: https://github.com/travis-ci/travis-ci/issues/4873
|
|
|
|
- if [[ ! -f ~/venv/bin/activate ]]; then virtualenv -p python ~/venv; fi
|
|
|
|
- source ~/venv/bin/activate
|
2017-05-09 14:42:11 +03:00
|
|
|
- pip install --disable-pip-version-check --upgrade pip==9.0.1
|
2016-05-26 15:44:31 +03:00
|
|
|
install:
|
|
|
|
- pip install --disable-pip-version-check --require-hashes -r requirements/common.txt -r requirements/dev.txt
|
2016-12-15 01:39:55 +03:00
|
|
|
before_script:
|
2017-04-19 15:44:46 +03:00
|
|
|
- while ! curl "$ELASTICSEARCH_URL" &> /dev/null; do sleep 1; done
|
2016-05-26 15:44:31 +03:00
|
|
|
script:
|
|
|
|
- py.test tests/webapp/ --runslow
|
|
|
|
|
2017-02-17 00:55:44 +03:00
|
|
|
# Job 6: Python Tests - Selenium integration
|
|
|
|
- env: python-tests-selenium
|
|
|
|
# TODO: Investigate switching back to the container infra, by setting `sudo: false`.
|
|
|
|
sudo: required
|
|
|
|
language: python
|
|
|
|
python: "2.7.13"
|
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- ~/venv
|
|
|
|
addons:
|
|
|
|
firefox: latest
|
|
|
|
services:
|
|
|
|
- rabbitmq
|
|
|
|
before_install:
|
2017-06-22 18:22:56 +03:00
|
|
|
- curl -sSo ~/elasticsearch.deb https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.3.1.deb && sudo dpkg -i --force-confold ~/elasticsearch.deb
|
|
|
|
- sudo service elasticsearch restart
|
2017-03-15 20:14:32 +03:00
|
|
|
- sudo cp vagrant/mysql.cnf /etc/mysql/conf.d/treeherder.cnf
|
2017-07-06 22:13:25 +03:00
|
|
|
- echo 'deb http://repo.mysql.com/apt/ubuntu/ trusty mysql-5.7' | sudo tee /etc/apt/sources.list.d/mysql.list > /dev/null
|
|
|
|
- sudo -E apt-get -yqq update
|
2017-07-07 02:05:40 +03:00
|
|
|
- sudo -E apt-get -yqq install --no-install-recommends --allow-unauthenticated mysql-server libmysqlclient-dev
|
2017-02-17 00:55:44 +03:00
|
|
|
# Create a clean virtualenv rather than using the one given to us,
|
|
|
|
# to work around: https://github.com/travis-ci/travis-ci/issues/4873
|
|
|
|
- if [[ ! -f ~/venv/bin/activate ]]; then virtualenv -p python ~/venv; fi
|
|
|
|
- source ~/venv/bin/activate
|
2017-05-09 14:42:11 +03:00
|
|
|
- pip install --disable-pip-version-check --upgrade pip==9.0.1
|
2017-02-17 00:55:44 +03:00
|
|
|
- mkdir -p $HOME/bin
|
2017-06-12 15:34:51 +03:00
|
|
|
- curl -sSfL https://github.com/mozilla/geckodriver/releases/download/v0.17.0/geckodriver-v0.17.0-linux64.tar.gz | tar -zxC $HOME/bin
|
2017-05-11 12:36:34 +03:00
|
|
|
- nvm install 7.10.0
|
2017-05-11 13:31:29 +03:00
|
|
|
# Required until Travis makes yarn available in the base image,
|
|
|
|
# since it only installs it for `language: nodejs` currently.
|
2017-03-01 16:06:15 +03:00
|
|
|
- curl -sSfL https://yarnpkg.com/install.sh | bash
|
|
|
|
- export PATH=$HOME/.yarn/bin:$PATH
|
2017-02-17 00:55:44 +03:00
|
|
|
install:
|
|
|
|
- pip install --disable-pip-version-check --require-hashes -r requirements/common.txt -r requirements/dev.txt
|
2017-03-01 16:06:15 +03:00
|
|
|
- yarn install --frozen-lockfile --no-bin-links
|
2017-02-17 00:55:44 +03:00
|
|
|
before_script:
|
2017-04-19 15:44:46 +03:00
|
|
|
- while ! curl "$ELASTICSEARCH_URL" &> /dev/null; do sleep 1; done
|
2017-02-17 00:55:44 +03:00
|
|
|
- "export DISPLAY=:99.0"
|
|
|
|
- "sh -e /etc/init.d/xvfb start"
|
|
|
|
- sleep 3 # give xvfb some time to start
|
|
|
|
script:
|
2017-06-29 21:32:54 +03:00
|
|
|
- yarn build
|
2017-02-17 00:55:44 +03:00
|
|
|
- py.test tests/selenium/ --runselenium --driver Firefox
|
|
|
|
|
2013-06-27 20:57:44 +04:00
|
|
|
notifications:
|
2015-03-08 18:00:57 +03:00
|
|
|
email:
|
|
|
|
on_success: never
|
|
|
|
on_failure: always
|