-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
71 lines (69 loc) · 2.92 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
language: python
# Cache the pip files
cache:
directories:
- $HOME/.cache/pip
- $HOME/.nvm
- node_modules
- wger/node_modules
# Use container infrastructure
# http://blog.travis-ci.com/2014-12-17-faster-builds-with-container-based-infrastructure/
sudo: false
# Python versions to test
python:
- "2.7"
- "3.4"
- "3.5"
# Manually define here the combinations environment variables to test
# https://github.com/travis-ci/travis-ci/issues/1519
env:
- TEST_MOBILE=True DB_TYPE=postgresql TRAVIS_NODE_VERSION="4" DB='wger' USER='postgres' PASSWORD='' HOST='localhost' PORT=5432 ENGINE='django.db.backends.postgresql'
- TEST_MOBILE=True DB_TYPE=sqlite TRAVIS_NODE_VERSION="4" DB='/home/travis/.local/share/wger/database.sqlite' USER='postgres' PASSWORD='' HOST='localhost' PORT=5432 ENGINE='django.db.backends.sqlite3'
- TEST_MOBILE=False DB_TYPE=postgresql TRAVIS_NODE_VERSION="4" DB='wger' USER='postgres' PASSWORD='' HOST='localhost' PORT=5432 ENGINE='django.db.backends.postgresql'
- TEST_MOBILE=False DB_TYPE=sqlite TRAVIS_NODE_VERSION="4" DB='/home/travis/.local/share/wger/database.sqlite' USER='postgres' PASSWORD='' HOST='localhost' PORT=5432 ENGINE='django.db.backends.sqlite3'
# Install the application
install:
# Update nvm and set wanted Node version.
# We update nvm using the script method instead of git, which is selected
# automatically, as git won't work because the $HOME/.nvm is not a git
# repository and the directory is not empty.
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | METHOD=script bash
- . $HOME/.nvm/nvm.sh
- nvm install $TRAVIS_NODE_VERSION
- nvm use $TRAVIS_NODE_VERSION
# Install requirements
- pip install -r requirements_devel.txt
- pip install wger
- npm install
- if [[ "$DB_TYPE" = "postgresql" ]]; then pip install psycopg2; fi
# Setup application
- if [[ "$DB_TYPE" = "sqlite" ]]; then wger create_settings; fi
- if [[ "$DB_TYPE" = "postgresql" ]]; then wger create_settings --database-type postgresql; fi
# Create test databases
before_script:
- npm install gulp
- if [[ "$DB_TYPE" = "postgresql" ]]; then psql -c 'DROP DATABASE IF EXISTS wger;' -U postgres; fi
- if [[ "$DB_TYPE" = "postgresql" ]]; then psql -c 'CREATE DATABASE wger;' -U postgres; fi
- invoke migrate_db --settings-path=/home/travis/.config/wger/settings.py
- python manage.py makemigrations core manager weight exercises nutrition software utils config gym email
- python manage.py migrate
# Do the tests
script:
# Formatting
- pep8 wger
# Javascript linting
- ./node_modules/.bin/gulp lint
# Regular application
- coverage run --source='.' ./manage.py test
# Code coverage
- coverage report
notifications:
slack: andela:OZefQdjnsTAbpFnQwexjb41q
deploy:
provider: heroku
api_key: $SECRET_KEY
app: wger-a-team
run: "python manage.py makemigrations && python manage.py migrate"
on:
repo: andela/wg-a-team
branch: develop