forked from simpeg/simpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
111 lines (96 loc) · 3.54 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
language: python
python:
- 3.6
sudo: false
addons:
apt:
packages:
- gcc
- gfortran
- libblas-dev
- liblapack-dev
env:
global:
- DEPLOY_DIR=tests/docs
- MASTER_BRANCH=master
- GAE_PROJECT=simpegdocs
- DOCS_PY=3.6 # deploy docs from 3.6
- PYPI_PY=3.6 # deploy to pypi from python 3.6
matrix:
- TEST_DIR=tests/em/fdem/inverse/derivs
- TEST_DIR=tests/em/tdem
- TEST_DIR="tests/em/static tests/seis tests/base tests/utils"
- TEST_DIR=tests/flow
- TEST_DIR="tests/em/nsem/forward tests/em/nsem/inversion"
- TEST_DIR=tests/em/fdem/inverse/adjoint
- TEST_DIR=tests/em/fdem/forward
- TEST_DIR=tests/em/vrm
- TEST_DIR=tests/pf
- TEST_DIR=tests/docs;
PATH=$PATH:${HOME}/google-cloud-sdk/bin;
PYTHONPATH=${PYTHONPATH}:${GAE_PYTHONPATH};
CLOUDSDK_CORE_DISABLE_PROMPTS=1
# Setup anaconda
before_install:
# Install packages
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- chmod +x miniconda.sh
- ./miniconda.sh -b -p $HOME/miniconda
- export PATH=/home/travis/anaconda/bin:/home/travis/miniconda/bin:$PATH
- conda update --yes conda
install:
- conda install --quiet --yes pip python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib cython ipython h5py;
- pip install -r requirements_dev.txt
- python setup.py install
- if [ "$TEST_DIR" = "$DEPLOY_DIR" ]; then
if [ ! -d ${HOME}/google-cloud-sdk ]; then curl https://sdk.cloud.google.com | bash; fi ;
pip install google-compute-engine;
openssl aes-256-cbc -K $encrypted_7e0a8632ac3f_key -iv $encrypted_7e0a8632ac3f_iv -in credentials.tar.gz.enc -out credentials.tar.gz -d ;
tar -xzf credentials.tar.gz ;
gcloud auth activate-service-account --key-file credentials/client-secret-docs.json ;
gsutil cp gs://simpeg/_build.tar.gz $PWD/docs ;
gsutil cp gs://simpeg/examples.tar.gz $PWD/docs/content ;
cd docs ;
tar -xzf _build.tar.gz _build;
cd content ;
tar -xzf examples.tar.gz examples;
cd ../../ ;
fi
# Run test
script:
# - nosetests $TEST_DIR --with-cov --cov SimPEG --cov-config .coveragerc -v -s
- nosetests $TEST_DIR --with-cov --cov SimPEG --cov-config .coveragerc -v -s;
# Calculate coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
# early exit if not on a deplotment branch
- if ! [ "$TRAVIS_BRANCH" = "$MASTER_BRANCH" -o "$TRAVIS_TAG" = "true" ]; then
echo "Not deploying (because this is not a deployment branch)" ;
exit 0 ;
fi
- if ! [ "$TEST_DIR" = "$DEPLOY_DIR" ]; then
echo "Not deploying (because this is not a deployment directory)" ;
exit 0 ;
fi
- if ! [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
echo "Not deploying (because this is a pull request)" ;
exit 0 ;
fi
# deploy docs
- if [ "$TRAVIS_BRANCH" = "$MASTER_BRANCH" ]; then
cd docs; tar -cvzf _build.tar.gz _build ;
cd content; tar -cvzf examples.tar.gz examples ; cd ../../ ;
gsutil cp docs/_build.tar.gz gs://simpeg ;
gsutil cp docs/content/examples.tar.gz gs://simpeg ;
gcloud auth activate-service-account --key-file credentials/client-secret.json ;
export GAE_PROJECT=$GAE_PROJECT ;
gcloud config set project $GAE_PROJECT;
gcloud app deploy ./docs/app.yaml --version ${TRAVIS_COMMIT} --promote;
fi;
#deploy to pypi
- if [ "$TRAVIS_TAG" = "true" ]; then
mv credentials/.pypirc ~/.pypirc ;
python setup.py sdist bdist_wheel --universal upload;
fi
notifications:
slack: simpeg:1KZq5giMtlJJ58TijIPgqf7n