config.yml 7.08 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/
5
6
#   - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8
#     - Replace binary_linux_wheel_py3.8 with the name of the job you want to test.
Edward Z. Yang's avatar
Edward Z. Yang committed
7
#       Job names are 'name:' key.
8

9
10
11
12
13
14
executors:
  windows-cpu:
    machine:
      resource_class: windows.xlarge
      image: windows-server-2019-vs2019:stable
      shell: bash.exe
peterjc123's avatar
peterjc123 committed
15

16
17
18
  windows-gpu:
    machine:
      resource_class: windows.gpu.nvidia.medium
19
      image: windows-server-2019-nvidia:stable
20
21
      shell: bash.exe

22
commands:
23
24
25
26
27
28
  generate_cache_key:
    description: "Generates a cache key file that changes daily"
    steps:
      - run:
          name: Generate cache key
          command: echo "$(date +"%Y-%m-%d")" > .cachekey
29
30
31
32
33
34
35
36
  designate_upload_channel:
    description: "inserts the correct upload channel into ${BASH_ENV}"
    steps:
      - run:
          name: adding UPLOAD_CHANNEL to BASH_ENV
          command: |
            our_upload_channel=nightly
            # On tags upload to test instead
37
            if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then
38
39
40
              our_upload_channel=test
            fi
            echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
Eli Uriegas's avatar
Eli Uriegas committed
41
42
43
44
45
46
47
  load_conda_channel_flags:
    description: "Determines whether we need extra conda channels"
    steps:
      - run:
          name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV
          command: |
              CONDA_CHANNEL_FLAGS=""
48
              # formerly used to add conda-forge flags for Python 3.9, reserving the mechanism for future python upgrades
49
50
51
52
53
54
55
  windows_install_cuda:
    description: "Install desired CUDA version on Windows runners"
    steps:
      - run:
          name: Install CUDA
          command: |
              packaging/windows/internal/cuda_install.bat
56

57
58
binary_common: &binary_common
  parameters:
Edward Z. Yang's avatar
Edward Z. Yang committed
59
    # Edit these defaults to do a release
60
61
62
63
64
65
66
67
68
69
    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:
70
      description: "Python version to build against (e.g., 3.8)"
71
      type: string
Nikita Shulga's avatar
Nikita Shulga committed
72
73
74
75
76
77
78
    cuda_version:
      description: "CUDA version to build against (e.g., cpu, cu101)"
      type: string
      default: "cpu"
    wheel_docker_image:
      description: "Wheel only: what docker image to use"
      type: string
atalman's avatar
atalman committed
79
      default: "pytorch/manylinux-cuda116"
Nikita Shulga's avatar
Nikita Shulga committed
80
81
82
    conda_docker_image:
      description: "Conda only: what docker image to use"
      type: string
atalman's avatar
atalman committed
83
      default: "pytorch/conda-builder:cuda116"
84
  environment: &environment
85
86
87
    PYTHON_VERSION: << parameters.python_version >>
    BUILD_VERSION: << parameters.build_version >>
    PYTORCH_VERSION: << parameters.pytorch_version >>
Nikita Shulga's avatar
Nikita Shulga committed
88
    CU_VERSION: << parameters.cuda_version >>
89
    MACOSX_DEPLOYMENT_TARGET: 10.9
90

Mingbo Wan's avatar
Mingbo Wan committed
91
92
93
smoke_test_common: &smoke_test_common
  <<: *binary_common
  docker:
94
    - image: pytorch/torchaudio_unittest_base:smoke_test-20220425
Caroline Chen's avatar
Caroline Chen committed
95
  resource_class: large
Mingbo Wan's avatar
Mingbo Wan committed
96

97
jobs:
98
99
  circleci_consistency:
    docker:
moto's avatar
moto committed
100
      - image: cimg/python:3.8
101
102
103
104
    steps:
      - checkout
      - run:
          command: |
105
            pip install --user --progress-bar off jinja2 pyyaml
106
107
108
            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)

109
110
  lint_python_and_config:
    docker:
Wei Wang's avatar
Wei Wang committed
111
      - image: circleci/python:3.8
112
113
114
115
116
117
118
119
120
121
    steps:
      - checkout
      - run:
          name: Install pre-commit
          command: pip install --user --progress-bar off pre-commit
      - run:
          name: Install pre-commit hooks
          command: pre-commit install-hooks
      - run:
          name: Lint Python code and config files
moto's avatar
moto committed
122
          command: pre-commit run --all-files
123
124
      - run:
          name: Required lint modifications
125
          when: always
moto's avatar
moto committed
126
          command: git --no-pager diff --color=always
127

128
  download_third_parties:
129
    docker:
moto's avatar
moto committed
130
      - image: "pytorch/torchaudio_unittest_base:manylinux"
131
132
133
    resource_class: small
    steps:
      - checkout
134
      - generate_cache_key
135
136
137
      - restore_cache:

          keys:
moto's avatar
moto committed
138
            - tp-nix-v2-{{ checksum ".cachekey" }}
139
140

      - run:
moto's avatar
moto committed
141
          command: |
142
143
              mkdir -p third_party/archives/
              wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt)
144
145
      - save_cache:

moto's avatar
moto committed
146
          key: tp-nix-v2-{{ checksum ".cachekey" }}
147
148

          paths:
149
            - third_party/archives
150
151
152
      - persist_to_workspace:
          root: third_party
          paths:
153
            - archives
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
  build_ffmpeg_linux:
    <<: *binary_common
    docker:
      - image: << parameters.wheel_docker_image >>
    resource_class: 2xlarge+
    steps:
      - checkout
      - generate_cache_key
      - restore_cache:

          keys:
            - ffmpeg-linux-v0-{{ checksum ".cachekey" }}

      - run:
          command: |
            export FFMPEG_ROOT=${PWD}/third_party/ffmpeg
            if [[ ! -d ${FFMPEG_ROOT} ]]; then
                packaging/ffmpeg/build.sh
            fi
      - save_cache:

          key: ffmpeg-linux-v0-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

  build_ffmpeg_macos:
    <<: *binary_common
    macos:
188
      xcode: "14.0"
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
    steps:
      - checkout
      - generate_cache_key
      - restore_cache:

          keys:
            - ffmpeg-macos-v0-{{ checksum ".cachekey" }}

      - run:
          command: |
            export FFMPEG_ROOT=${PWD}/third_party/ffmpeg
            if [[ ! -d ${FFMPEG_ROOT} ]]; then
                packaging/ffmpeg/build.sh
            fi
      - save_cache:

          key: ffmpeg-macos-v0-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

  build_ffmpeg_windows:
    <<: *binary_common
    machine:
      resource_class: windows.xlarge
      image: windows-server-2019-vs2019:stable
      # Note:
      # Unlike other Windows job, this job uses cmd.exe as shell because
      # we need to invoke bash.exe from msys2 in ffmpeg build process, and doing so
      # from different installation of bash.exe (the one from the VM) cause issue
      shell: cmd.exe
    steps:
      - checkout
      - run: date /t > .cachekey
      - restore_cache:

          keys:
            - ffmpeg-windows-{{ checksum ".cachekey" }}

      - run: packaging\ffmpeg\build.bat
      - save_cache:

          key: ffmpeg-windows-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

244
workflows:
245
246
247
  lint:
    jobs:
      - lint_python_and_config
moto's avatar
moto committed
248
249
  unittest:
    jobs:
250
      - circleci_consistency