treeherder/.travis.yml

117 строки
4.4 KiB
YAML

dist: xenial
# Use the latest Travis images since they are more up to date than the stable release.
group: edge
jobs:
include:
# Run JS tests
- language: node_js
# The Node version here must be kept in sync with that in `package.json`.
node_js: '12.13.0'
cache: yarn
before_install:
# Try to keep version in sync with `package.json`
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.19.1
- export PATH="$HOME/.yarn/bin:$PATH"
install:
- yarn install --frozen-lockfile
script:
# `yarn build` is tested as part of the Heroku build job
- yarn lint
# `yarn lint` only checks the formatting of JS/JSX, this will also check CSS/HTML/JSON/Markdown/YAML.
- yarn format:check
- yarn test:coverage
- yarn codecov
# Run Heroku build & release related code
# This build is configured to catch issues on PRs that would only be detected as part of Heroku's
# build step when the code has already been merged to master
# The step ./bin/post_compile requires the output of `yarn build`, thus, we need to build
# both the JS and Python builds
- env:
- NODE_ENV=production YARN_PRODUCTION=true
# Since we're using Python/pip and Node/yarn use the generic image
language: generic
cache:
directories:
- $HOME/.cache/yarn
- $HOME/.cache/pip
- node_modules
before_install:
# XXX: I have not been able to install 3.7.2 to match runtime.txt
- pyenv global 3.7.1
- nvm install 12.14.1
- nvm use 12.14.1
# Steps to validate versions in use
- python --version
- pip --version
- node --version
- yarn --version
install:
- pip install -r requirements.txt
- yarn install
script:
- yarn heroku-postbuild
- ./manage.py collectstatic --noinput
# This generates the revision and does the Brotly/Gzip compression
- ./bin/post_compile
# Run Python tests & linters outside of the Docker containers
- language: python
python: '3.7'
cache: pip
install:
# Initialize services required to run tests
- docker-compose up --detach mysql redis rabbitmq
- pip install -r requirements/docs.txt # Install separately since it has no hashes
- pip install -r requirements/dev.txt
- pip install -r requirements/common.txt
script:
- pre-commit run --all-files markdownlint
- ./runchecks.sh
- ./manage.py check
# 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
# Exercising running tests outside of Docker
- pytest tests/ --ignore=tests/selenium --ignore=tests/extract
# This is to deal with running the containers with --detached
- docker-compose down
# Run Python tests inside of the Docker containers
- language: shell
services:
- docker
install:
- docker-compose build
- pip install codecov --user
script:
- docker-compose run backend bash -c "pytest --cov --cov-report=xml tests/ --runslow --ignore=tests/selenium"
- codecov -f coverage.xml
# Run Python Selenium tests
- language: node_js
services:
- docker
# The Node version here must be kept in sync with that in `package.json`.
node_js: '12.13.0'
cache: yarn
before_install:
- docker-compose build
install:
- yarn install
- pip install codecov --user
before_script:
# Run in `before_script` to prevent the Selenium tests from running if the UI build fails.
- yarn build
script:
# XXX: We have the Gecko driver inside of the Docker instance, thus, needing Selenium tests
# running inside the Docker container
- docker-compose run backend bash -c "pytest --cov --cov-report=xml tests/selenium/"
- codecov -f coverage.xml
notifications:
email:
on_success: never
on_failure: always