treeherder/.travis.yml

106 строки
3.7 KiB
YAML

dist: trusty
# The fully visualised "sudo" GCE environments are faster for longer running jobs.
sudo: required
# Use the latest Travis images since they are more up to date than the stable release.
group: edge
matrix:
include:
# Job 1: Linters
- env: python2-linters
sudo: false
language: python
python: "2.7.15"
cache:
directories:
- ${HOME}/venv
install:
- source ./bin/travis-setup.sh python_env docs
script:
- pip check
- python lints/queuelint.py
- flake8 --show-source
- isort --check-only --diff --quiet
- git grep -El '^#!/.+\b(bash|sh)\b' | xargs shellcheck
- make -C docs html
# Job 2: Python 3 linters
- env: python3-linters
sudo: false
language: python
python: "3.6.5"
cache:
directories:
- ${HOME}/venv
install:
- source ./bin/travis-setup.sh python_env
# Create the test database for `manage.py check --deploy`.
- mysql -u root -e 'create database test_treeherder;'
script:
- pip check
- flake8 --show-source
# 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
# Job 3: Nodejs UI tests
- env: js-tests
language: node_js
node_js: "8"
cache:
directories:
- node_modules
install:
- source ./bin/travis-setup.sh js_env
script:
- yarn test
- yarn build
# Job 4: Python Tests - Main
- env: python-tests-main
language: python
python: "2.7.15"
cache:
directories:
- ${HOME}/venv
install:
- source ./bin/travis-setup.sh services python_env
# Create the test database for `manage.py check --deploy`.
- mysql -u root -e 'create database test_treeherder;'
script:
# 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.
- SITE_URL='https://treeherder.dev' TREEHERDER_DEBUG='False' ./manage.py check --deploy --fail-level WARNING
# 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/ --runslow --ignore=tests/selenium/
# Job 5: Python Tests - Selenium integration
- env: python-tests-selenium
language: python
python: "2.7.15"
cache:
directories:
- ${HOME}/venv
- node_modules
install:
- nvm install 8
- source ./bin/travis-setup.sh services python_env geckodriver js_env
before_script:
# Run in `before_script` to prevent the selenium tests from still being run if the UI build fails.
- yarn build
script:
# 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
notifications:
email:
on_success: never
on_failure: always