-
Notifications
You must be signed in to change notification settings - Fork 199
/
.travis.yml
142 lines (135 loc) · 7.38 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# Setting up automatic travis test build.
sudo: required
language: python
branches:
only:
- master
- dev
conditions: v1
services:
- docker
env:
global:
- VERSION=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
before_install:
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
openssl aes-256-cbc -K $encrypted_7b48abc79884_key -iv $encrypted_7b48abc79884_iv -in rel_travis.enc -out rel_travis -d;
fi
install: true
jobs:
include:
- stage: test for other branches
if: (branch != master) OR (fork = true)
name: "Build and test"
script:
- docker pull fentechai/nv-cdt-env-base:21.01
- docker build --build-arg python=3.6 --build-arg spy=36 -t fentechai/cdt-dev .
- if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
docker run -e CODECOV_TOKEN --rm fentechai/cdt-dev /bin/sh -c 'cd /CDT && pip3 uninstall cdt -y && python3 setup.py install develop --user && pytest --cov-report=xml --cov=./cdt && codecov --token $CODECOV_TOKEN';
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin;
docker push fentechai/cdt-dev;
docker build -f nv-Dockerfile -t fentechai/nv-cdt-dev .;
docker push fentechai/nv-cdt-dev;
else docker run --rm fentechai/cdt-dev /bin/sh -c 'cd /CDT && pip3 uninstall cdt -y && python3 setup.py install develop --user && pytest';
fi
- stage: build docs only
if: (branch = master) AND (fork = false) AND (commit_message =~ \[DOC\])
name: Build docs only
script:
- git pull
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/cdt:$VERSION
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI Docs"
- chmod 600 rel_travis
- eval `ssh-agent -s`
- ssh-add rel_travis
- git config --global push.default simple
- docker run -v $(pwd):/cdtlib --rm fentechai/cdt:$VERSION /bin/sh -c 'cd /cdtlib && pip3 uninstall cdt -y && pip3 install . && pip3 install sphinx recommonmark sphinxcontrib-napoleon sphinx_rtd_theme && cd docs && sphinx-build -Eab html . html'
- git remote add deploy [email protected]:FenTechSolutions/CausalDiscoveryToolbox.git
- git add ./docs
- git commit -m "[DEPLOY] Docs $VERSION_NEW [skip travis-ci]"
- git push deploy HEAD:master
- stage: build docker image
if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\])
name: "Build and push 3.6 image for testing"
script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/cdt-env-base:21.01
- docker build --build-arg python=3.6 --build-arg spy=36 -t fentechai/cdt-test .
- docker push fentechai/cdt-test
- stage: test
if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\])
name: "Test and bumpversion"
script: docker run -e CODECOV_TOKEN --rm fentechai/cdt-test /bin/sh -c 'cd /CDT && pip3 uninstall cdt -y && python3 setup.py install develop --user && pytest --cov-report= --cov=./cdt && codecov --token $CODECOV_TOKEN'
after_success:
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI Bumpversion"
- chmod 600 rel_travis
- eval `ssh-agent -s`
- ssh-add rel_travis
- git config --global push.default simple
- pip install bumpversion
- if [[ $TRAVIS_COMMIT_MESSAGE == *"[NV]"* ]];
then echo "No version update";
elif [[ $TRAVIS_COMMIT_MESSAGE == *"[REL]"* ]];
then bumpversion --current-version $VERSION minor setup.py README.md docs/index.rst docs/conf.py cdt/__init__.py;
elif [[ $TRAVIS_COMMIT_MESSAGE == *"[MREL]"* ]];
then bumpversion --current-version $VERSION major setup.py README.md docs/index.rst docs/conf.py cdt/__init__.py;
else bumpversion --current-version $VERSION patch setup.py README.md docs/index.rst docs/conf.py cdt/__init__.py;
fi
- git remote add deploy [email protected]:FenTechSolutions/CausalDiscoveryToolbox.git
- git add -u
- VERSION_NEW=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
- git commit -m "[DEPLOY] $VERSION_NEW [skip travis-ci]"
- git push deploy HEAD:master
- stage: deploy 1st stage
if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\])
name: "Build and push 3.6"
script:
- git pull
- VERSION_NEW=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/cdt-env-base:21.01
- docker build --build-arg python=3.6 --build-arg spy=36 -t fentechai/cdt:$VERSION_NEW .
- docker push fentechai/cdt:$VERSION_NEW
- docker tag fentechai/cdt:$VERSION_NEW fentechai/cdt:latest
- docker push fentechai/cdt:latest
- if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\])
name: "Build and push nv-3.6"
script:
- git pull
- VERSION_NEW=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/nv-cdt-env-base:21.01
- docker build --build-arg python=3.6 --build-arg spy=36 -f nv-Dockerfile -t fentechai/nv-cdt:$VERSION_NEW .
- docker push fentechai/nv-cdt:$VERSION_NEW
- docker tag fentechai/nv-cdt:$VERSION_NEW fentechai/nv-cdt:latest
- docker push fentechai/nv-cdt:latest
- stage: deploy 2nd stage
if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\]) AND (not commit_message =~ \[NV\])
name: "Push on Pypi"
script:
- git pull
- VERSION_NEW=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/cdt:$VERSION_NEW
- docker run -e PYPI_PASSWORD --rm fentechai/cdt:$VERSION_NEW /bin/sh -c 'cd /CDT && pip3 install --upgrade keyrings.alt && pip3 install twine wheel && python3 setup.py sdist bdist_wheel && twine upload -u divkal -p "$PYPI_PASSWORD" dist/*'
- if: (branch = master) AND (fork = false) AND (not commit_message =~ \[DOC\])
name: "Compile docs and push"
script:
- git pull
- VERSION_NEW=$(cat setup.py| grep version | cut -c 20- | rev | cut -c 3- | rev)
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker pull fentechai/cdt:$VERSION_NEW
- git config --global user.email "[email protected]"
- git config --global user.name "Travis CI Docs"
- chmod 600 rel_travis
- eval `ssh-agent -s`
- ssh-add rel_travis
- git config --global push.default simple
- docker run -v $(pwd):/cdtlib --rm fentechai/cdt:$VERSION_NEW /bin/sh -c 'cd /cdtlib && pip3 uninstall cdt -y && pip3 install . && pip3 install sphinx recommonmark sphinxcontrib-napoleon sphinx_rtd_theme && cd docs && sphinx-build -Eab html . html'
- git remote add deploy [email protected]:FenTechSolutions/CausalDiscoveryToolbox.git
- git add ./docs
- git commit -m "[DEPLOY] Docs $VERSION_NEW [skip travis-ci]"
- git push deploy HEAD:master