forked from fecgov/openFEC-web-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
94 lines (82 loc) · 3.48 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
language: python
sudo: false
cache: pip
python:
- "3.4"
addons:
postgresql: "9.4"
env:
global:
- FEC_WEB_TEST="true"
- FEC_SELENIUM_DRIVER="remote"
- secure: "cmEueYaeTjqjnql7Vfk/qeZCIMfQRZLsEIA1WackpB5PQJxTAXfTFN6zq4r1LgYTxoOLGFi8s9a3zUJpJ7Nz+IYTEult/ehyW4mqbcYE1zodGDb55AllkmlvdYPbxKf0dJvGnMpcIqvgtAsKHGogOmBGEEc0uoiV3FFx1GvKCnM="
- secure: "HjtrA4/I9b8m8ySCyL4VjJMmFyuYWrvZKWVSQFMCN7CklLXbn+UBdUl41Dk5ZUKijBZpLmrC4RSEJh8bFO6n0IbEvpGsmdL1FgqhBekPc1jfvzbOzjRvpKYuXtyzQcPv+FpBGXo9NydSh2OqEyNms2YBk9tZkRnhu/6G+10385o="
- secure: "H7oyl5s7ZcmP/0Nf4jGkoTe7qov3kTu1e6QbeXmTS2yENoetI7tFBtMG0QYNBVPmu3QK64mA+VpnDdTa3+hXF6yjXkqEBq//f5/47ZIf5Z7lGyyFdefNH1KKumfDJoQQ2LA2m5ENOvDP6iR/3S4C6798Dc5Zt37t7yPhwj4D+7Q="
- secure: "hT2S6JTWsSU+qPzxnsNJxBanOu2obvbF7LNVUQKkdL22HV69vqUJxuEyccmwgcyN2gKzsK2aQOtDlwxYPM/7taRcmhG53RlPYVPRvlYZn7E3glAn9lWZYLWgYxRvYuZjmcithVDGLhNYu0nytmJPaF6Rve2xBaVODTytfDusbqE="
# This matrix runs n+1 jobs: one for each in `include`, and one with no non-global
# environment variables set. This allows the build that does not use Sauce Labs
# to run without a tunnel to Sauce.
matrix:
include:
- env: FEC_SAUCE_BROWSER=chrome
addons: &addons
sauce_connect: true
postgresql: "9.4"
python: "3.4"
- env: FEC_SAUCE_BROWSER=firefox
addons: *addons
python: "3.4"
before_install:
- travis_retry pip install codecov
- travis_retry curl -L -o travis_after_all.py https://raw.github.com/jmcarp/travis_after_all/master/travis_after_all.py
- travis_retry curl -L -o cf.tgz "https://cli.run.pivotal.io/stable?release=linux64-binary&version=6.11.3&source=github-rel"
- tar xzvf cf.tgz
- export PATH=.:$PATH
before_script:
# Set up environment
- |
if [[ $TRAVIS_BRANCH = 'master' ]]; then
export FEC_BRANCH=master
else export FEC_BRANCH=develop
fi
# Install web app and run in background
- travis_retry pip install -U pip wheel
- travis_retry pip install -r requirements.txt
- travis_retry npm install
- travis_retry npm install -g gulp
- travis_retry npm install karma-phantomjs-launcher karma-phantomjs-shim
- npm run build
- python __init__.py &
# Install API and run in background
- travis_retry git clone https://github.com/18F/openFEC
- cd openFEC
- git checkout $FEC_BRANCH
- psql -c 'create database cfdm_test' -U postgres
- pg_restore --dbname cfdm_test data/subset.dump --no-acl --no-owner
- travis_retry pip install -r requirements.txt
- travis_retry pip install -r requirements-dev.txt
- python manage.py update_all --processes 1
- python manage.py runserver &
- cd ..
script:
# Run Python unit tests
- if [[ -z $FEC_SAUCE_BROWSER ]]; then py.test; fi
# Run Javascript unit tests
- if [[ -z $FEC_SAUCE_BROWSER ]]; then npm run test-single; fi
# Run Selenium tests if not pull request
- if [[ $TRAVIS_PULL_REQUEST = 'false' && ! -z $FEC_SAUCE_BROWSER ]]; then py.test --selenium; fi
after_success:
# Deploy to appropriate Cloud Foundry space after all builds succeed
# See `tasks.deploy` for details
- python travis_after_all.py
- export $(cat .to_export_back)
- |
if [[ $BUILD_LEADER = 'YES' && $TRAVIS_PULL_REQUEST = 'false' ]]; then
if [[ $BUILD_AGGREGATE_STATUS = 'others_succeeded' ]]; then
echo "All builds passed; deploying..."
invoke deploy --branch $TRAVIS_BRANCH --yes
else
echo "One or more builds failed; skipping deploy"
fi
fi
- if [[ $BUILD_LEADER = 'YES' ]]; then codecov; fi