config.yml 15.9 KB
Newer Older
1
2
version: 2.1

3
# How to test the Linux jobs:
4
#   - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
Edward Z. Yang's avatar
Edward Z. Yang committed
5
6
7
#   - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.7
#     - Replace binary_linux_wheel_py3.7 with the name of the job you want to test.
#       Job names are 'name:' key.
8

peterjc123's avatar
peterjc123 committed
9
10
11
orbs:
  win: circleci/windows@2.0.0

12
13
binary_common: &binary_common
  parameters:
Edward Z. Yang's avatar
Edward Z. Yang committed
14
    # Edit these defaults to do a release
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
    build_version:
      description: "version number of release binary; by default, build a nightly"
      type: string
      default: ""
    pytorch_version:
      description: "PyTorch version to build against; by default, use a nightly"
      type: string
      default: ""
    # Don't edit these
    python_version:
      description: "Python version to build against (e.g., 3.7)"
      type: string
    unicode_abi:
      description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)"
      type: string
      default: ""
  environment:
    PYTHON_VERSION: << parameters.python_version >>
    BUILD_VERSION: << parameters.build_version >>
    PYTORCH_VERSION: << parameters.pytorch_version >>
    UNICODE_ABI: << parameters.unicode_abi >>
Edward Z. Yang's avatar
Edward Z. Yang committed
36
    CU_VERSION: cpu
37

Mingbo Wan's avatar
Mingbo Wan committed
38
39
40
41
42
43
44
45
smoke_test_common: &smoke_test_common
  <<: *binary_common
  docker:
    - image: 308535385114.dkr.ecr.us-east-1.amazonaws.com/torchaudio/smoke_test:d26af7d0-8458-face-book-84239b5c75c0
      aws_auth:
        aws_access_key_id: ${ECR_AWS_ACCESS_KEY}
        aws_secret_access_key: ${ECR_AWS_SECRET_ACCESS_KEY}

46
jobs:
47
48
49
50
51
52
53
  circleci_consistency:
    docker:
      - image: circleci/python:3.7
    steps:
      - checkout
      - run:
          command: |
54
            pip install --user --progress-bar off jinja2 pyyaml
55
56
57
            python .circleci/regenerate.py
            git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)

58
  binary_linux_wheel:
59
    <<: *binary_common
60
    docker:
61
      - image: "pytorch/manylinux-cuda100"
62
63
64
    resource_class: 2xlarge+
    steps:
      - checkout
65
      - run: packaging/build_wheel.sh
66
      - store_artifacts:
67
          path: dist
Edward Z. Yang's avatar
Edward Z. Yang committed
68
69
70
71
      - persist_to_workspace:
          root: dist
          paths:
            - "*"
72
73

  binary_linux_conda:
74
    <<: *binary_common
75
    docker:
76
      - image: "pytorch/conda-cuda"
77
78
79
    resource_class: 2xlarge+
    steps:
      - checkout
80
      - run: packaging/build_conda.sh
81
82
      - store_artifacts:
          path: /opt/conda/conda-bld/linux-64
Edward Z. Yang's avatar
Edward Z. Yang committed
83
84
85
86
      - persist_to_workspace:
          root: /opt/conda/conda-bld/linux-64
          paths:
            - "*"
87

peterjc123's avatar
peterjc123 committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  binary_win_conda:
    <<: *binary_common
    executor:
      name: win/default
      shell: bash.exe
    steps:
      - checkout
      - run:
          command: |
            choco install miniconda3
            (& "C:\tools\miniconda3\Scripts\conda.exe" "shell.powershell" "hook") | Out-String | Invoke-Expression
            conda activate base
            conda install -yq conda-build "conda-package-handling!=1.5.0"
            bash packaging/build_conda.sh
          shell: powershell.exe

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  binary_macos_wheel:
    <<: *binary_common
    macos:
      xcode: "9.0"
    steps:
      - checkout
      - run:
          # Cannot easily deduplicate this as source'ing activate
          # will set environment variables which we need to propagate
          # to build_wheel.sh
          command: |
            curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
            sh conda.sh -b
            source $HOME/miniconda3/bin/activate
            packaging/build_wheel.sh
      - store_artifacts:
          path: dist
Edward Z. Yang's avatar
Edward Z. Yang committed
121
122
123
124
      - persist_to_workspace:
          root: dist
          paths:
            - "*"
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140

  binary_macos_conda:
    <<: *binary_common
    macos:
      xcode: "9.0"
    steps:
      - checkout
      - run:
          command: |
            curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
            sh conda.sh -b
            source $HOME/miniconda3/bin/activate
            conda install -yq conda-build
            packaging/build_conda.sh
      - store_artifacts:
          path: /Users/distiller/miniconda3/conda-bld/osx-64
Edward Z. Yang's avatar
Edward Z. Yang committed
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
      - persist_to_workspace:
          root: /Users/distiller/miniconda3/conda-bld/osx-64
          paths:
            - "*"

  # Requires org-member context
  binary_conda_upload:
    docker:
      - image: continuumio/miniconda
    steps:
      - attach_workspace:
          at: ~/workspace
      - run:
          command: |
            # Prevent credential from leaking
            conda install -yq anaconda-client
            set +x
            anaconda login \
                --username "$PYTORCH_BINARY_PJH5_CONDA_USERNAME" \
                --password "$PYTORCH_BINARY_PJH5_CONDA_PASSWORD"
            set -x
            anaconda upload ~/workspace/*.tar.bz2 -u pytorch-nightly --label main --no-progress --force

  # Requires org-member context
  binary_wheel_upload:
    docker:
      - image: circleci/python:3.7
    steps:
      - attach_workspace:
          at: ~/workspace
      - checkout
      - run:
          command: |
            pip install --user awscli
            export PATH="$HOME/.local/bin:$PATH"
            # Prevent credential from leaking
            set +x
            export AWS_ACCESS_KEY_ID="${PYTORCH_BINARY_AWS_ACCESS_KEY_ID}"
            export AWS_SECRET_ACCESS_KEY="${PYTORCH_BINARY_AWS_SECRET_ACCESS_KEY}"
            set -x
            for pkg in ~/workspace/*.whl; do
              aws s3 cp "$pkg" "s3://pytorch/whl/nightly/" --acl public-read
            done
184

Mingbo Wan's avatar
Mingbo Wan committed
185
186
187
  smoke_test_linux_conda:
    <<: *smoke_test_common
    steps:
Mingbo Wan's avatar
Mingbo Wan committed
188
189
      - attach_workspace:
          at: ~/workspace
Mingbo Wan's avatar
Mingbo Wan committed
190
      - run:
Mingbo Wan's avatar
Mingbo Wan committed
191
          name: install binaries
Mingbo Wan's avatar
Mingbo Wan committed
192
193
194
          command: |
            set -x
            source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
Mingbo Wan's avatar
Mingbo Wan committed
195
196
197
198
199
200
            conda install -v -y -c pytorch-nightly pytorch
            conda install -v -y $(ls ~/workspace/torchaudio*.tar.bz2)
      - run:
          name: smoke test
          command: |
            source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
Mingbo Wan's avatar
Mingbo Wan committed
201
202
203
204
205
            python -c "import torchaudio"

  smoke_test_linux_pip:
    <<: *smoke_test_common
    steps:
Mingbo Wan's avatar
Mingbo Wan committed
206
207
      - attach_workspace:
          at: ~/workspace
Mingbo Wan's avatar
Mingbo Wan committed
208
      - run:
Mingbo Wan's avatar
Mingbo Wan committed
209
          name: install binaries
Mingbo Wan's avatar
Mingbo Wan committed
210
211
212
          command: |
            set -x
            source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
Mingbo Wan's avatar
Mingbo Wan committed
213
214
215
216
217
            pip install $(ls ~/workspace/torchaudio*.whl) -f https://download.pytorch.org/whl/nightly/torch_nightly.html
      - run:
          name: smoke test
          command: |
            source /usr/local/etc/profile.d/conda.sh && conda activate python${PYTHON_VERSION}
Mingbo Wan's avatar
Mingbo Wan committed
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
            python -c "import torchaudio"

  docker_image_build:
    machine:
      image: ubuntu-1604:201903-01
    resource_class: large
    environment:
      image_name: torchaudio/smoke_test
    steps:
      - checkout
      - run:
          name: build_docker image
          no_output_timeout: "1h"
          command: |
            cd .circleci/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID}
      - run:
          name: upload docker image
          no_output_timeout: "1h"
          command: |
            set +x
            export AWS_ACCESS_KEY_ID=${ECR_AWS_ACCESS_KEY}
            export AWS_SECRET_ACCESS_KEY=${ECR_AWS_SECRET_ACCESS_KEY}
            eval $(aws ecr get-login --region us-east-1 --no-include-email)
            set -x
            docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}
            docker push 308535385114.dkr.ecr.us-east-1.amazonaws.com/${image_name}:${CIRCLE_WORKFLOW_ID}

245
246
247
workflows:
  build:
    jobs:
248
249
250
      - circleci_consistency
      - binary_linux_wheel:
          name: binary_linux_wheel_py3.5
251
          python_version: '3.5'
252
253
      - binary_linux_wheel:
          name: binary_linux_wheel_py3.6
254
          python_version: '3.6'
255
256
      - binary_linux_wheel:
          name: binary_linux_wheel_py3.7
257
          python_version: '3.7'
258
259
      - binary_macos_wheel:
          name: binary_macos_wheel_py3.5
260
          python_version: '3.5'
261
262
      - binary_macos_wheel:
          name: binary_macos_wheel_py3.6
263
          python_version: '3.6'
264
265
      - binary_macos_wheel:
          name: binary_macos_wheel_py3.7
266
          python_version: '3.7'
267
268
      - binary_linux_conda:
          name: binary_linux_conda_py3.5
269
          python_version: '3.5'
270
271
      - binary_linux_conda:
          name: binary_linux_conda_py3.6
272
          python_version: '3.6'
273
274
      - binary_linux_conda:
          name: binary_linux_conda_py3.7
275
          python_version: '3.7'
276
277
      - binary_macos_conda:
          name: binary_macos_conda_py3.5
278
          python_version: '3.5'
279
280
      - binary_macos_conda:
          name: binary_macos_conda_py3.6
281
          python_version: '3.6'
282
283
      - binary_macos_conda:
          name: binary_macos_conda_py3.7
284
          python_version: '3.7'
peterjc123's avatar
peterjc123 committed
285
286
287
      - binary_win_conda:
          name: torchaudio_win_py3.6
          python_version: "3.6"
Edward Z. Yang's avatar
Edward Z. Yang committed
288
289
290
291
292

  nightly:
    jobs:
      - circleci_consistency
      - binary_linux_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
293
294
295
          filters:
            branches:
              only: nightly
296
297
          name: nightly_binary_linux_wheel_py3.5
          python_version: '3.5'
Edward Z. Yang's avatar
Edward Z. Yang committed
298
299
      - binary_wheel_upload:
          context: org-member
300
301
302
          filters:
            branches:
              only: nightly
303
          name: nightly_binary_linux_wheel_py3.5_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
304
          requires:
305
          - nightly_binary_linux_wheel_py3.5
Mingbo Wan's avatar
Mingbo Wan committed
306
      - smoke_test_linux_pip:
Edward Z. Yang's avatar
Edward Z. Yang committed
307
308
309
          filters:
            branches:
              only: nightly
310
311
312
313
          name: nightly_binary_linux_wheel_py3.5_smoke_test_pip
          python_version: '3.5'
          requires:
          - nightly_binary_linux_wheel_py3.5_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
314
      - binary_linux_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
315
316
317
          filters:
            branches:
              only: nightly
318
319
          name: nightly_binary_linux_wheel_py3.6
          python_version: '3.6'
Edward Z. Yang's avatar
Edward Z. Yang committed
320
321
      - binary_wheel_upload:
          context: org-member
322
323
324
          filters:
            branches:
              only: nightly
325
          name: nightly_binary_linux_wheel_py3.6_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
326
          requires:
327
          - nightly_binary_linux_wheel_py3.6
Mingbo Wan's avatar
Mingbo Wan committed
328
      - smoke_test_linux_pip:
Edward Z. Yang's avatar
Edward Z. Yang committed
329
330
331
          filters:
            branches:
              only: nightly
332
333
334
335
          name: nightly_binary_linux_wheel_py3.6_smoke_test_pip
          python_version: '3.6'
          requires:
          - nightly_binary_linux_wheel_py3.6_upload
336
      - binary_linux_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
337
338
339
          filters:
            branches:
              only: nightly
340
341
          name: nightly_binary_linux_wheel_py3.7
          python_version: '3.7'
342
343
      - binary_wheel_upload:
          context: org-member
344
345
346
          filters:
            branches:
              only: nightly
347
          name: nightly_binary_linux_wheel_py3.7_upload
348
          requires:
349
          - nightly_binary_linux_wheel_py3.7
Mingbo Wan's avatar
Mingbo Wan committed
350
      - smoke_test_linux_pip:
Edward Z. Yang's avatar
Edward Z. Yang committed
351
352
353
          filters:
            branches:
              only: nightly
354
355
356
357
          name: nightly_binary_linux_wheel_py3.7_smoke_test_pip
          python_version: '3.7'
          requires:
          - nightly_binary_linux_wheel_py3.7_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
358
      - binary_macos_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
359
360
361
          filters:
            branches:
              only: nightly
362
363
          name: nightly_binary_macos_wheel_py3.5
          python_version: '3.5'
Edward Z. Yang's avatar
Edward Z. Yang committed
364
365
      - binary_wheel_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
366
367
368
          filters:
            branches:
              only: nightly
369
370
371
          name: nightly_binary_macos_wheel_py3.5_upload
          requires:
          - nightly_binary_macos_wheel_py3.5
Edward Z. Yang's avatar
Edward Z. Yang committed
372
      - binary_macos_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
373
374
375
          filters:
            branches:
              only: nightly
376
377
          name: nightly_binary_macos_wheel_py3.6
          python_version: '3.6'
Edward Z. Yang's avatar
Edward Z. Yang committed
378
379
      - binary_wheel_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
380
381
382
          filters:
            branches:
              only: nightly
383
384
385
          name: nightly_binary_macos_wheel_py3.6_upload
          requires:
          - nightly_binary_macos_wheel_py3.6
386
      - binary_macos_wheel:
Edward Z. Yang's avatar
Edward Z. Yang committed
387
388
389
          filters:
            branches:
              only: nightly
390
391
          name: nightly_binary_macos_wheel_py3.7
          python_version: '3.7'
392
393
      - binary_wheel_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
394
395
396
          filters:
            branches:
              only: nightly
397
398
399
          name: nightly_binary_macos_wheel_py3.7_upload
          requires:
          - nightly_binary_macos_wheel_py3.7
Edward Z. Yang's avatar
Edward Z. Yang committed
400
      - binary_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
401
402
403
          filters:
            branches:
              only: nightly
404
405
          name: nightly_binary_linux_conda_py3.5
          python_version: '3.5'
Edward Z. Yang's avatar
Edward Z. Yang committed
406
407
      - binary_conda_upload:
          context: org-member
408
409
410
          filters:
            branches:
              only: nightly
411
          name: nightly_binary_linux_conda_py3.5_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
412
          requires:
413
          - nightly_binary_linux_conda_py3.5
Mingbo Wan's avatar
Mingbo Wan committed
414
      - smoke_test_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
415
416
417
          filters:
            branches:
              only: nightly
418
419
420
421
          name: nightly_binary_linux_conda_py3.5_smoke_test_conda
          python_version: '3.5'
          requires:
          - nightly_binary_linux_conda_py3.5_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
422
      - binary_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
423
424
425
          filters:
            branches:
              only: nightly
426
427
          name: nightly_binary_linux_conda_py3.6
          python_version: '3.6'
Edward Z. Yang's avatar
Edward Z. Yang committed
428
429
      - binary_conda_upload:
          context: org-member
430
431
432
          filters:
            branches:
              only: nightly
433
          name: nightly_binary_linux_conda_py3.6_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
434
          requires:
435
          - nightly_binary_linux_conda_py3.6
Mingbo Wan's avatar
Mingbo Wan committed
436
      - smoke_test_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
437
438
439
          filters:
            branches:
              only: nightly
440
441
442
443
          name: nightly_binary_linux_conda_py3.6_smoke_test_conda
          python_version: '3.6'
          requires:
          - nightly_binary_linux_conda_py3.6_upload
444
      - binary_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
445
446
447
          filters:
            branches:
              only: nightly
448
449
          name: nightly_binary_linux_conda_py3.7
          python_version: '3.7'
450
451
      - binary_conda_upload:
          context: org-member
452
453
454
          filters:
            branches:
              only: nightly
455
          name: nightly_binary_linux_conda_py3.7_upload
456
          requires:
457
          - nightly_binary_linux_conda_py3.7
Mingbo Wan's avatar
Mingbo Wan committed
458
      - smoke_test_linux_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
459
460
461
          filters:
            branches:
              only: nightly
462
463
464
465
          name: nightly_binary_linux_conda_py3.7_smoke_test_conda
          python_version: '3.7'
          requires:
          - nightly_binary_linux_conda_py3.7_upload
Edward Z. Yang's avatar
Edward Z. Yang committed
466
      - binary_macos_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
467
468
469
          filters:
            branches:
              only: nightly
470
471
          name: nightly_binary_macos_conda_py3.5
          python_version: '3.5'
Edward Z. Yang's avatar
Edward Z. Yang committed
472
473
      - binary_conda_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
474
475
476
          filters:
            branches:
              only: nightly
477
478
479
          name: nightly_binary_macos_conda_py3.5_upload
          requires:
          - nightly_binary_macos_conda_py3.5
Edward Z. Yang's avatar
Edward Z. Yang committed
480
      - binary_macos_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
481
482
483
          filters:
            branches:
              only: nightly
484
485
          name: nightly_binary_macos_conda_py3.6
          python_version: '3.6'
Edward Z. Yang's avatar
Edward Z. Yang committed
486
487
      - binary_conda_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
488
489
490
          filters:
            branches:
              only: nightly
491
492
493
          name: nightly_binary_macos_conda_py3.6_upload
          requires:
          - nightly_binary_macos_conda_py3.6
494
      - binary_macos_conda:
Edward Z. Yang's avatar
Edward Z. Yang committed
495
496
497
          filters:
            branches:
              only: nightly
498
499
          name: nightly_binary_macos_conda_py3.7
          python_version: '3.7'
500
501
      - binary_conda_upload:
          context: org-member
Edward Z. Yang's avatar
Edward Z. Yang committed
502
503
          filters:
            branches:
Mingbo Wan's avatar
Mingbo Wan committed
504
              only: nightly
505
506
507
          name: nightly_binary_macos_conda_py3.7_upload
          requires:
          - nightly_binary_macos_conda_py3.7
Mingbo Wan's avatar
Mingbo Wan committed
508
509
510
511
512
513
514
515
516
517
  docker_build:
    triggers:
      - schedule:
          cron: "0 10 * * 0"
          filters:
            branches:
              only:
                - master
    jobs:
      - docker_image_build