-
Notifications
You must be signed in to change notification settings - Fork 512
/
Copy pathconfig.yml
272 lines (239 loc) · 7.22 KB
/
config.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
version: 2.1
commands:
pip_install:
description: "Install dependencies via pip"
parameters:
args:
type: string
default: ""
steps:
- run:
name: "Install dependencies via pip"
command: ./scripts/install_via_pip.sh << parameters.args >>
conda_install:
description: "Install dependencies via conda"
parameters:
args:
type: string
default: ""
steps:
- run:
name: "Install dependencies via conda"
command: ./scripts/install_via_conda.sh << parameters.args >>
lint_flake8:
description: "Lint with flake8"
steps:
- run:
name: "Lint with flake8"
command: flake8
ufmt_check:
description: "Check formatting with ufmt"
steps:
- run:
name: "Check formatting with ufmt"
command: ufmt check .
mypy_check:
description: "Static type checking with mypy"
steps:
- run:
name: "Mypy checks"
command: ./scripts/run_mypy.sh
unit_tests:
description: "Run unit tests"
steps:
- run:
name: "Run unit tests"
command: python -m pytest -ra --cov=. --cov-report term-missing
sphinx:
description: "Run sphinx"
steps:
- run:
name: "Run sphinx"
command: sphinx-build -T --keep-going sphinx/source sphinx/build
configure_github_bot:
description: "Configure Docusaurus GitHub bot"
steps:
- run:
name: "Configure Docusaurus GitHub bot"
# Do not do this if we don't have the right org (pytorch), or if this is just a PR
command: |
if [[ $CIRCLE_PROJECT_USERNAME == "pytorch" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
git config --global user.email "docusaurus-bot@users.noreply.github.com"
git config --global user.name "Captum website deployment script"
echo "machine github.com login docusaurus-bot password $DOCUSAURUS_GITHUB_TOKEN" > ~/.netrc
fi
deploy_site:
description: "Deploy website to GitHub Pages"
steps:
- run:
name: "Deploy website to GitHub Pages"
# TODO: make the installation above conditional on there being relevant changes (no need to install if there are none)
command: |
if ! git diff --name-only HEAD^ | grep -E "(^captum\/.*)|(^\.circleci\/.*)|(^docs\/.*)|(^website\/.*)|(^scripts\/.*)|(^sphinx\/.*)|(^tutorials\/.*)"; then
echo "Skipping deploy. No relevant website files have changed"
elif [[ $CIRCLE_PROJECT_USERNAME == "pytorch" && -z $CI_PULL_REQUEST && -z $CIRCLE_PR_USERNAME ]]; then
mkdir -p website/static/.circleci && cp -a .circleci/. website/static/.circleci/.
./scripts/build_docs.sh -b
cd website
GIT_USER=docusaurus-bot yarn run publish-gh-pages
else
echo "Skipping deploy."
fi
simple_pip_install:
description: "Simple install of Captum via pip. Does not include extra dependencies such as yarn and nodejs needed for building insights."
steps:
- run:
name: "Simple PIP install"
command: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
py_3_7_setup:
description: "Set python version to 3.7 and install pip and pytest"
steps:
- run:
name: "Switch to Python v3.7"
command: |
pyenv versions
pyenv install 3.7.0
pyenv global 3.7.0
install_cuda:
description: "Install CUDA for GPU Machine"
steps:
- run:
name: "Install CUDA"
command: |
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub
sudo apt-get update
sudo apt-get --yes --force-yes install cuda
jobs:
lint_py36:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install
- lint_flake8
- ufmt_check
- sphinx
test_py36_pip:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install:
args: "-n"
- mypy_check
- unit_tests
test_py36_pip_release:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install
- mypy_check
- unit_tests
test_py36_pip_torch_1_6:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install:
args: "-v 1.6"
- unit_tests
test_py36_pip_torch_1_7:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install:
args: "-v 1.7"
- unit_tests
test_py36_pip_torch_1_8:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install:
args: "-v 1.8"
- unit_tests
test_py36_pip_torch_1_9:
docker:
- image: circleci/python:3.6.8
steps:
- checkout
- pip_install:
args: "-v 1.9"
- unit_tests
test_py37_conda:
docker:
- image: continuumio/miniconda3
steps:
- checkout
- conda_install:
args: "-n"
- unit_tests
test_cuda_multi_gpu:
machine:
image: ubuntu-2004:202201-02
resource_class: gpu.nvidia.medium.multi
steps:
- checkout
- install_cuda
- py_3_7_setup
- simple_pip_install
- unit_tests
auto_deploy_site:
docker:
- image: circleci/python:3.6.8-node
steps:
- checkout
- pip_install:
args: "-n -d"
- configure_github_bot
- deploy_site
aliases:
- &exclude_ghpages_fbconfig
branches:
ignore:
- gh-pages
- fb-config
workflows:
lint_test_and_deploy_site:
jobs:
- lint_py36:
filters: *exclude_ghpages_fbconfig
- test_py36_pip:
filters: *exclude_ghpages_fbconfig
- test_py36_pip_release:
filters: *exclude_ghpages_fbconfig
- test_py37_conda:
filters: *exclude_ghpages_fbconfig
- test_py36_pip_torch_1_6:
filters: *exclude_ghpages_fbconfig
- test_py36_pip_torch_1_7:
filters: *exclude_ghpages_fbconfig
- test_py36_pip_torch_1_8:
filters: *exclude_ghpages_fbconfig
- test_py36_pip_torch_1_9:
filters: *exclude_ghpages_fbconfig
- test_cuda_multi_gpu:
filters: *exclude_ghpages_fbconfig
- auto_deploy_site:
requires:
- lint_py36
- test_py36_pip
- test_py36_pip_release
- test_py37_conda
- test_py36_pip_torch_1_6
- test_py36_pip_torch_1_7
- test_py36_pip_torch_1_8
- test_py36_pip_torch_1_9
- test_cuda_multi_gpu
filters:
branches:
only:
- master