|
1 | | -language: python |
2 | | - |
3 | | -python: |
4 | | - - "3.6" |
5 | | - |
6 | | -install: |
7 | | - # Install conda |
8 | | - - wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh |
9 | | - - bash miniconda.sh -b -p $HOME/miniconda |
10 | | - - export PATH="$HOME/miniconda/bin:$PATH" |
11 | | - - python -c 'import os,sys,fcntl; flags = fcntl.fcntl(sys.stdout, fcntl.F_GETFL); fcntl.fcntl(sys.stdout, fcntl.F_SETFL, flags&~os.O_NONBLOCK);' |
12 | | - - conda clean --all -y |
13 | | - - ./python_env_build.sh |
14 | | - - source activate pb_env |
15 | | - - python manage.py collectstatic --no-input |
16 | | - |
17 | | -addons: |
18 | | - postgresql: "9.4" |
19 | | - |
20 | | -before_script: |
21 | | - - psql -c 'create database test_db;' -U postgres |
22 | | - |
23 | | -script: |
24 | | - - py.test webapp/apps/ |
| 1 | +matrix: |
| 2 | + include: |
| 3 | + - language: ruby # Cannot be 'minimal' in order to have PostgreSQL |
| 4 | + |
| 5 | + sudo: required |
| 6 | + |
| 7 | + services: docker |
| 8 | + |
| 9 | + env: TAG=${TRAVIS_COMMIT::6} |
| 10 | + |
| 11 | + # Need NEW_RELIC_TOKEN to be defined in Travis settings |
| 12 | + install: |
| 13 | + - make NEW_RELIC_TOKEN=$NEW_RELIC_TOKEN webapp-build |
| 14 | + - pip install --user git-lint pylint pycodestyle |
| 15 | + - export PATH=$PATH:/$HOME/.local/bin |
| 16 | + |
| 17 | + addons: |
| 18 | + postgresql: "9.4" |
| 19 | + |
| 20 | + before_script: psql -c 'create database mypb;' -U postgres |
| 21 | + |
| 22 | + script: |
| 23 | + - > |
| 24 | + docker run --net host -e PORT=80 -e DJANGO_SETTINGS_MODULE=webapp.settings |
| 25 | + -e DROPQ_WORKERS=127.0.0.1:5050 |
| 26 | + -e DATABASE_URL=postgresql://postgres@localhost/mypb |
| 27 | + -it opensourcepolicycenter/web:$TAG |
| 28 | + /bin/bash -c "pip install -q pytest-django && py.test webapp/apps" |
| 29 | + - if git reset --soft ${TRAVIS_COMMIT_RANGE%...*}; then git lint; fi |
| 30 | + |
| 31 | + before_deploy: |
| 32 | + # Need HEROKU_TOKEN to be defined in Travis settings |
| 33 | + - curl https://cli-assets.heroku.com/install.sh | sh |
| 34 | + - echo "machine api.heroku.com password $HEROKU_TOKEN" > ~/.netrc |
| 35 | + - docker login --username=_ --password=$HEROKU_TOKEN registry.heroku.com |
| 36 | + |
| 37 | + deploy: |
| 38 | + provider: script |
| 39 | + script: make MODE=test webapp-release |
| 40 | + on: |
| 41 | + branch: travis |
| 42 | + |
| 43 | + - language: minimal |
| 44 | + |
| 45 | + sudo: required |
| 46 | + |
| 47 | + services: docker |
| 48 | + |
| 49 | + # Also need OSPC_ANACONDA_TOKEN, AWS_ACCOUNT_ID, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to be defined in settings |
| 50 | + env: TAG=${TRAVIS_COMMIT::6} |
| 51 | + |
| 52 | + install: make OSPC_ANACONDA_TOKEN=$OSPC_ANACONDA_TOKEN dist-build |
| 53 | + |
| 54 | + script: make dist-test |
| 55 | + |
| 56 | + deploy: |
| 57 | + provider: script |
| 58 | + script: bash distributed/deploy.sh staging |
| 59 | + on: |
| 60 | + branch: travis |
0 commit comments