2018-07-26 15:26:32 +03:00
|
|
|
dist: xenial
|
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
|
2019-05-17 00:56:02 +03:00
|
|
|
services:
|
|
|
|
- docker
|
2015-10-29 22:57:07 +03:00
|
|
|
matrix:
|
|
|
|
include:
|
2018-10-01 22:02:32 +03:00
|
|
|
- env: js-tests
|
|
|
|
language: node_js
|
2019-03-12 00:39:34 +03:00
|
|
|
# The Node version here must be kept in sync with that in `package.json`.
|
2019-03-29 03:45:04 +03:00
|
|
|
node_js: '11'
|
2018-10-01 22:02:32 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
|
|
|
- node_modules
|
|
|
|
install:
|
2019-05-17 00:56:02 +03:00
|
|
|
- yarn install --frozen-lockfile
|
2018-10-01 22:02:32 +03:00
|
|
|
script:
|
Bug 1364894 - Upgrade from Neutrino 4 to 9 (#4216)
Neutrino controls our frontend linting, transpilation, source-maps,
testing, dev-server and optimisation of production builds.
Highlights of the upgrade are:
* Major version updates to the individual tools within (such as webpack,
Babel and ESLint), significantly improving performance, fixing
transpilation/minification correctness bugs, adding support for newer
ECMAScript features, and increasing linter coverage.
* Hot reloading in the dev server now works for all entry-points and not
just the jobs view, shortening the feedback cycle.
* Reduced bundle size due to webpack 4's tree shaking, scope hoisting,
automatic shared/vendor code chunk splitting (no need for the manually
maintained 'vendor' list).
* CSS is now extracted out of JS, which improves performance, reduces
bundle size and prevents the initial white flash of un-styled content.
* Support for dynamic imports/code splitting (needed for bug 1502192).
* Support for Jest via a new Jest preset (unblocks bug 1364045).
* Support for public class field declarations (unblocks bug 1480166).
* Improved source-maps (increases the quality of production exception
trace-backs and fixes several debugger breakpoint bugs).
* Reduced amount of custom configuration required for our fairly complex
frontend needs, reducing maintenance burden and allowing for easier
future Neutrino upgrades.
In addition this PR:
* Fixes the WhiteNoise `immutable_file_test()` regex, so that it now
correctly enables browser caching of images, fonts and source maps.
* Enables webpack-dev-server's overlay feature, which displays any
compilation errors in the browser, saving having to switch back
to the console (this can be enabled for warnings too if desired).
* Enables webpack-dev-server's automatic browser-opening feature,
which saves having to manually navigate to `localhost:5000` after
running `yarn start`.
* Switches Karma tests to run Firefox in headless mode, reducing the
workflow disruption when running `yarn test`.
* Uses the new webpack `performance` option to enable maximum asset
file size thresholds, to help prevent bundle-size regressions.
* Rewrites the `package.json` script commands so that they now work
correctly on Windows, even when setting environment variables.
Performance comparison:
* Local `yarn build`:
- Cached: 2m34s -> 23s
- Uncached: 2m34s -> 58s
* Local `yarn start`:
- Cached: 34.5s -> 13.6s
- Uncached: 34.5s -> 31.3s
* Local `yarn test`
- Cached: 61.5s -> 19.8s
- Uncached: 61.5s -> 22.0s
* Local `yarn lint`
- Cached: 3.8s -> 1.8s
- Uncached: 13.7s -> 13.4s
* Travis end-to-end time:
9 minutes -> 6 minutes
* Heroku deploy end-to-end time:
14 minutes -> 9 minutes
2018-11-02 21:48:28 +03:00
|
|
|
# `yarn build` is tested as part of the Selenium job.
|
|
|
|
- yarn lint
|
2019-01-22 19:13:47 +03:00
|
|
|
# `yarn lint` only checks the formatting of JS/JSX, this will also check CSS/HTML/JSON/Markdown/YAML.
|
|
|
|
- yarn format:check
|
2019-09-10 21:22:37 +03:00
|
|
|
- yarn test:coverage
|
2019-09-09 22:56:17 +03:00
|
|
|
after_success: yarn codecov
|
2018-10-01 22:02:32 +03:00
|
|
|
|
2019-08-17 00:23:49 +03:00
|
|
|
- env: test-prod-build
|
|
|
|
language: node_js
|
|
|
|
# The Node version here must be kept in sync with that in `package.json`.
|
|
|
|
node_js: '11'
|
|
|
|
install:
|
|
|
|
- yarn install --prod --frozen-lockfile
|
|
|
|
script:
|
|
|
|
- yarn build
|
|
|
|
|
2019-02-21 10:38:24 +03:00
|
|
|
- env: python-linters
|
2019-05-17 00:56:02 +03:00
|
|
|
language: minimal
|
2015-10-29 23:04:33 +03:00
|
|
|
install:
|
2019-05-17 00:56:02 +03:00
|
|
|
- docker-compose build
|
2015-10-29 23:04:33 +03:00
|
|
|
script:
|
2019-05-17 00:56:02 +03:00
|
|
|
- docker-compose run backend ./runtests.sh
|
2015-10-29 23:04:33 +03:00
|
|
|
|
2019-02-21 10:38:24 +03:00
|
|
|
- env: python-tests-main
|
2019-05-17 00:56:02 +03:00
|
|
|
language: minimal
|
2017-11-03 02:44:02 +03:00
|
|
|
install:
|
2019-05-17 00:56:02 +03:00
|
|
|
- docker-compose build
|
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.
|
2019-05-17 00:56:02 +03:00
|
|
|
- docker-compose run -e SITE_URL=https://treeherder.dev -e TREEHERDER_DEBUG=False backend python -bb ./manage.py check --deploy --fail-level WARNING
|
|
|
|
# Using `-bb` mode to surface BytesWarnings: https://docs.python.org/3.7/using/cmdline.html#cmdoption-b
|
|
|
|
- docker-compose run backend python -bb -m pytest tests/ --runslow --ignore=tests/selenium/
|
2015-11-11 15:41:44 +03:00
|
|
|
|
2019-02-21 10:38:24 +03:00
|
|
|
- env: python-tests-selenium
|
2019-05-17 00:56:02 +03:00
|
|
|
language: node_js
|
|
|
|
# The Node version here must be kept in sync with that in `package.json`.
|
|
|
|
node_js: '11'
|
2017-02-17 00:55:44 +03:00
|
|
|
cache:
|
|
|
|
directories:
|
2017-08-15 18:21:51 +03:00
|
|
|
- node_modules
|
2019-05-17 00:56:02 +03:00
|
|
|
before_install:
|
|
|
|
- docker-compose build
|
2017-02-17 00:55:44 +03:00
|
|
|
install:
|
2019-05-17 00:56:02 +03:00
|
|
|
- yarn install
|
2017-12-12 17:51:04 +03:00
|
|
|
before_script:
|
2019-05-17 00:56:02 +03:00
|
|
|
# Run in `before_script` to prevent the Selenium tests from running if the UI build fails.
|
2017-06-29 21:32:54 +03:00
|
|
|
- yarn build
|
2017-12-12 17:51:04 +03:00
|
|
|
script:
|
2019-05-17 00:56:02 +03:00
|
|
|
# Using `-bb` mode to surface BytesWarnings: https://docs.python.org/3.7/using/cmdline.html#cmdoption-b
|
|
|
|
- docker-compose run backend python -bb -m pytest tests/selenium/
|
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
|