forked from pytorch/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
163 lines (131 loc) · 5.15 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
language: python
python:
- "2.7"
- "3.6"
env:
- PYTORCH_PACKAGE=pytorch-cpu
- PYTORCH_PACKAGE=pytorch-nightly-cpu
stages:
- Lint check
- Test
- Docs
- Deploy
before_install: &before_install
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
# Useful for debugging any issues with conda
- conda info -a
- conda create -q -n test-environment -c pytorch python=$TRAVIS_PYTHON_VERSION $PYTORCH_PACKAGE
- source activate test-environment
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install enum34; fi
# Test contrib dependencies
- pip install tqdm scikit-learn
install:
- python setup.py install
- pip install numpy mock pytest codecov pytest-cov
# Examples dependencies
- pip install visdom torchvision tensorboardX
- pip install gym
- pip install tqdm
script:
- py.test --cov ignite --cov-report term-missing
# Smoke tests for the examples
# Mnist
# 1) mnist.py
- python examples/mnist/mnist.py --epochs=1
# 2) mnist_with_visdom.py
- python -c "from visdom.server import download_scripts; download_scripts()" # download scripts : https://github.com/facebookresearch/visdom/blob/master/py/server.py#L929
- python -m visdom.server &
- sleep 10
- python examples/mnist/mnist_with_visdom.py --epochs=1
- kill %1
# 3) mnist_with_tensorboardx.py
- python examples/mnist/mnist_with_tensorboardx.py --epochs=1
# dcgan.py
- python examples/gan/dcgan.py --dataset fake --dataroot /tmp/fakedata --output-dir /tmp/outputs-dcgan --batch-size 2 --epochs 2 --workers 0
# RL
# 1) Actor-Critic
- python examples/reinforcement_learning/actor_critic.py --max-episodes=2
# 2) Reinforce
- python examples/reinforcement_learning/reinforce.py --max-episodes=2
#fast-neural-style
#train
- python examples/fast_neural_style/neural_style.py train --epochs 1 --cuda 0 --dataset test --dataroot . --image_size 32 --style_image examples/fast_neural_style/images/style_images/mosaic.jpg --style_size 32
after_success:
- codecov
jobs:
include:
- stage: Lint check
python: "3.5"
before_install: # Nothing to do
install: pip install flake8
script: flake8
after_success: # Nothing to do
# GitHub Pages Deployment: https://docs.travis-ci.com/user/deployment/pages/
- stage: Docs
python: "3.5"
# Use previously defined before_install
before_install: *before_install
install:
- pip install -r docs/requirements.txt
# `pip install .` vs `python setup.py install` : 1st works better to produce _module/ignite with source links
- pip install .
script:
- cd docs && make html
# Create .nojekyll file to serve correctly _static and friends
- touch build/html/.nojekyll
after_success: # Nothing to do
# Deploy built docs when PR is merged to master
deploy:
provider: pages
skip-cleanup: true
github-token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
keep-history: false
local_dir: docs/build/html
on:
branch: master
- stage: Deploy
python: "3.5"
env:
- PYTORCH_PACKAGE=pytorch-cpu
if: tag IS present
# Use previously defined before_install
before_install: *before_install
install:
- python setup.py install
script: true
after_success: # Nothing to do
before_deploy:
# Conda deploy if on tag
# ANACONDA_TOKEN should be provided by Travis
# How to generate ANACONDA_TOKEN: https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-accounts#creating-access-tokens
# https://conda.io/docs/user-guide/tasks/build-packages/install-conda-build.html
- conda install -y conda-build conda-verify anaconda-client
- conda config --set anaconda_upload no
- conda build --quiet --no-test --output-folder conda_build conda.recipe
# Convert to other platforms: OSX, WIN
- conda convert --platform win-64 conda_build/linux-64/*.tar.bz2 -o conda_build/
- conda convert --platform osx-64 conda_build/linux-64/*.tar.bz2 -o conda_build/
# Upload to Anaconda
# We could use --all but too much platforms to uploaded
- ls conda_build/*/*.tar.bz2 | xargs -I {} anaconda -v -t $ANACONDA_TOKEN upload -u pytorch {}
# PyPI Deployment: https://docs.travis-ci.com/user/deployment/pypi/
deploy:
provider: pypi
user: $PYPI_USER
# If password contains non alphanumeric characters
# https://github.com/travis-ci/dpl/issues/377
# pass it as secured variable
password: $PYPI_TOKEN
# otherwise, follow "How to encrypt the password": https://docs.travis-ci.com/user/encryption-keys/
# `travis encrypt deploy.password="password"`
# secure: "secured_password"
skip_cleanup: true
distributions: "sdist bdist_wheel"
on:
tags: true