forked from pytorch/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
174 lines (149 loc) · 5.89 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
164
165
166
167
168
169
170
171
172
173
174
language: python
os:
- linux
dist: bionic
python:
- "3.7"
env:
- PYTORCH_CHANNEL=pytorch
- PYTORCH_CHANNEL=pytorch-nightly
stages:
- Lint check
- Test
- Docs
- Deploy
- Nightly
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 pytorch cpuonly python=$TRAVIS_PYTHON_VERSION -c $PYTORCH_CHANNEL
- source activate test-environment
# Keep fix in case of problem with torchvision nightly releases
# - if [[ "$PYTORCH_CHANNEL" == "pytorch-nightly" ]]; then pip install --upgrade git+https://github.com/pytorch/vision.git; else conda install torchvision cpuonly python=$TRAVIS_PYTHON_VERSION -c $PYTORCH_CHANNEL; fi
- conda install torchvision cpuonly python=$TRAVIS_PYTHON_VERSION -c $PYTORCH_CHANNEL
# Install all test/examples dependencies
- pip install -r requirements-dev.txt
install:
- python setup.py install
script:
- CI_PYTHON_VERSION="$TRAVIS_PYTHON_VERSION" sh tests/run_cpu_tests.sh
after_success:
- codecov -F cpu || echo 'Codecov upload failed'
jobs:
include:
- stage: Lint check
python: "3.7"
before_install: # Nothing to do
install: pip install flake8 "black==19.10b0" "isort==4.3.21" "mypy==0.782"
script:
- flake8 .
- black --check .
- isort -rc -c .
- mypy --config-file mypy.ini
after_success: # Nothing to do
# GitHub Pages Deployment: https://docs.travis-ci.com/user/deployment/pages/
- stage: Docs
python: "3.7"
if: type != cron
# Use previously defined before_install
before_install: *before_install
install:
- pip install -r docs/requirements.txt
- pip install git+https://github.com/vfdev-5/sphinxcontrib-versioning.git
script:
- sphinx-versioning --use-master-conf --use-master-templates build --greatest-tag --whitelist-branches master docs/source docs/build/html
# Create .nojekyll file to serve correctly _static and friends
- touch docs/build/html/.nojekyll
after_success: # Nothing to do
# Deploy built docs : a) when PR is merged to master, b) when a tag is built
deploy:
- provider: pages
edge: true
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
- provider: pages
edge: true
token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable
keep_history: false
local_dir: docs/build/html
on:
tags: true
- stage: Deploy
python: "3.7"
env:
- PYTORCH_CHANNEL=pytorch
- UPLOAD_USER=pytorch
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: &before_deploy
# 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
- travis_wait 60 conda build --quiet --no-test --output-folder conda_build conda.recipe -c pytorch
# 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 $UPLOAD_USER {}
# PyPI Deployment: https://docs.travis-ci.com/user/deployment/pypi/
deploy:
edge: true
provider: pypi
username: $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"
distributions: "sdist bdist_wheel"
on:
tags: true
- stage: Nightly
python: "3.7"
if: type = cron
env:
- PYTORCH_CHANNEL=pytorch-nightly
- UPLOAD_USER=pytorch-nightly
# Use previously defined before_install
before_install: *before_install
install:
- sed -i "s/__version__ = \"\(.*\)\"/__version__ = \"\1.dev$(date -u +%Y%m%d)\"/g" ignite/__init__.py
script: true
after_success: # Nothing to do
before_deploy: *before_deploy
# PyPI Deployment: https://docs.travis-ci.com/user/deployment/pypi/
deploy:
edge: true
provider: pypi
username: $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"
distributions: "sdist bdist_wheel"
on:
branch:
- master