2016-12-15 01:26:55 +03:00
|
|
|
dist: trusty
|
2017-08-15 18:39:41 +03:00
|
|
|
# The fully visualised "sudo" GCE environments are faster for longer running jobs.
|
|
|
|
sudo: required
|
2017-08-15 18:27:25 +03:00
|
|
|
# Use the latest Travis images since they are more up to date than the stable release.
|
|
|
|
group: edge
|
2015-10-29 22:57:07 +03:00
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
|
2016-05-04 20:03:00 +03:00
|
|
|
# Job 1: Linters
|
2017-09-04 00:35:00 +03:00
|
|
|
- env: python2-linters
|
2015-10-29 23:04:33 +03:00
|
|
|
sudo: false
|
|
|
|
language: python
|
2018-05-03 15:01:21 +03:00
|
|
|
python: "2.7.15"
|
2015-10-29 23:04:33 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
2017-11-03 02:39:36 +03:00
|
|
|
- ${HOME}/venv
|
2015-10-29 23:04:33 +03:00
|
|
|
install:
|
2017-11-27 17:05:47 +03:00
|
|
|
- source ./bin/travis-setup.sh python_env docs
|
2015-10-29 23:04:33 +03:00
|
|
|
script:
|
2017-07-26 13:04:03 +03:00
|
|
|
- pip check
|
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
|
2017-11-03 18:58:56 +03:00
|
|
|
- git grep -El '^#!/.+\b(bash|sh)\b' | xargs shellcheck
|
2018-07-20 16:55:59 +03:00
|
|
|
- make html
|
2015-10-29 23:04:33 +03:00
|
|
|
|
2017-11-03 02:44:02 +03:00
|
|
|
# Job 2: Python 3 linters
|
2017-09-04 00:35:00 +03:00
|
|
|
- env: python3-linters
|
|
|
|
sudo: false
|
|
|
|
language: python
|
2018-04-03 19:58:21 +03:00
|
|
|
python: "3.6.5"
|
2017-09-04 00:35:00 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
2017-11-03 02:39:36 +03:00
|
|
|
- ${HOME}/venv
|
2017-09-04 00:35:00 +03:00
|
|
|
install:
|
2017-11-03 02:44:02 +03:00
|
|
|
- source ./bin/travis-setup.sh python_env
|
2018-03-21 21:06:45 +03:00
|
|
|
# Create the test database for `manage.py check --deploy`.
|
|
|
|
- mysql -u root -e 'create database test_treeherder;'
|
2017-09-04 00:35:00 +03:00
|
|
|
script:
|
|
|
|
- pip check
|
2018-03-19 13:30:49 +03:00
|
|
|
- flake8 --show-source
|
2018-04-05 19:14:10 +03:00
|
|
|
# Temporarily running these in the linters job to avoid impacting job count and thus Travis end-to-end times.
|
|
|
|
# Prevent connections during check/migrate/makemigrations to a non-existent Elasticsearch server.
|
|
|
|
- unset ELASTICSEARCH_URL
|
|
|
|
- SITE_URL='https://treeherder.dev' TREEHERDER_DEBUG='False' ./manage.py check --deploy --fail-level WARNING
|
|
|
|
# Remove these once we get the roughly equivalent pytest sanity tests working under Python 3.
|
|
|
|
- ./manage.py migrate
|
|
|
|
- ./manage.py makemigrations --check
|
2017-09-04 00:35:00 +03:00
|
|
|
|
|
|
|
# Job 3: Nodejs UI tests
|
2018-04-10 21:09:05 +03:00
|
|
|
- env: js-tests
|
2015-10-29 23:20:32 +03:00
|
|
|
language: node_js
|
2018-05-09 13:49:49 +03:00
|
|
|
node_js: "10"
|
2015-10-29 23:20:32 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- node_modules
|
|
|
|
install:
|
2017-11-03 02:44:02 +03:00
|
|
|
- source ./bin/travis-setup.sh js_env
|
2015-10-29 23:20:32 +03:00
|
|
|
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
|
|
|
|
2018-04-10 21:09:05 +03:00
|
|
|
# Job 4: Python Tests - Main
|
2015-10-30 00:48:07 +03:00
|
|
|
- env: python-tests-main
|
2015-10-29 23:26:03 +03:00
|
|
|
language: python
|
2018-05-03 15:01:21 +03:00
|
|
|
python: "2.7.15"
|
2016-05-04 20:05:19 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
2017-11-03 02:39:36 +03:00
|
|
|
- ${HOME}/venv
|
2017-11-03 02:44:02 +03:00
|
|
|
install:
|
|
|
|
- source ./bin/travis-setup.sh services python_env
|
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
|
|
|
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
|
2018-04-14 01:14:36 +03:00
|
|
|
# Using Python 2's `-3` mode to surface DeprecationWarnings for Python 3 incompatibilities:
|
|
|
|
# https://docs.python.org/2/using/cmdline.html#cmdoption-3
|
2018-01-22 14:47:36 +03:00
|
|
|
- python -3 -m pytest tests/ --runslow --ignore=tests/selenium/
|
2015-11-11 15:41:44 +03:00
|
|
|
|
2018-04-10 21:09:05 +03:00
|
|
|
# Job 5: Python Tests - Selenium integration
|
2017-02-17 00:55:44 +03:00
|
|
|
- env: python-tests-selenium
|
|
|
|
language: python
|
2018-05-03 15:01:21 +03:00
|
|
|
python: "2.7.15"
|
2017-02-17 00:55:44 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
2017-11-03 02:39:36 +03:00
|
|
|
- ${HOME}/venv
|
2017-08-15 18:21:51 +03:00
|
|
|
- node_modules
|
2017-02-17 00:55:44 +03:00
|
|
|
install:
|
2018-05-09 13:49:49 +03:00
|
|
|
- nvm install 10
|
2017-11-03 02:44:02 +03:00
|
|
|
- source ./bin/travis-setup.sh services python_env geckodriver js_env
|
2017-12-12 17:51:04 +03:00
|
|
|
before_script:
|
|
|
|
# Run in `before_script` to prevent the selenium tests from still being run if the UI build fails.
|
2017-06-29 21:32:54 +03:00
|
|
|
- yarn build
|
2017-12-12 17:51:04 +03:00
|
|
|
script:
|
2018-04-14 01:14:36 +03:00
|
|
|
# Using Python 2's `-3` mode to surface DeprecationWarnings for Python 3 incompatibilities:
|
|
|
|
# https://docs.python.org/2/using/cmdline.html#cmdoption-3
|
|
|
|
- python -3 -m pytest tests/selenium/ --driver Firefox
|
2017-02-17 00:55:44 +03:00
|
|
|
|
2013-06-27 20:57:44 +04:00
|
|
|
notifications:
|
2015-03-08 18:00:57 +03:00
|
|
|
email:
|
|
|
|
on_success: never
|
2017-11-03 02:31:00 +03:00
|
|
|
on_failure: always
|