fast-test.yml 13.8 KB
Newer Older
1
2
3
# To reduce debug cost, steps are sorted differently on each platform,
# so that a bug in any module will cause at least one platform to fail quickly.

4
5
6
7
8
9
10
11
12
13
14
stages:
- stage: lint
  jobs:
  - job: docs
    pool:
      vmImage: ubuntu-latest
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
    steps:
    - task: UsePythonVersion@0
      inputs:
15
        versionSpec: 3.9
16
17
18
19
20
21
22
      displayName: Configure Python version
    - script: |
        sudo apt-get install -y pandoc
        sudo apt-get remove swig -y
        sudo apt-get install swig3.0 -y
        sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
      displayName: Install apt packages
Yuge Zhang's avatar
Yuge Zhang committed
23
24
25
26
27
28
29
30
    - task: Cache@2
      inputs:
        key: 'python | "$(Agent.OS)" | dependencies/*.txt'
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages
31
32
33
34
35
36
    - script: |
        set -e
        python -m pip install -U -r dependencies/setup.txt
        python -m pip install -r dependencies/develop.txt
        python -m pip install -r dependencies/required.txt
        python -m pip install -r dependencies/recommended.txt
37
        python -m pip install -r dependencies/required_extra.txt
38
      displayName: Install requirements
liuzhe-lz's avatar
liuzhe-lz committed
39
40
41
    - script: |
        python test/vso_tools/interim_patch.py
      displayName: Apply patch
42
43
44
45
    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
46
47
48
49
50
51
52
53
54
55
56
57
58
    - script: |
        cd docs/en_US
        sphinx-build -M html . _build -W --keep-going -T
      displayName: Sphinx  # TODO: rstcheck

  - job: python
    pool:
      vmImage: ubuntu-latest
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
    steps:
    - task: UsePythonVersion@0
      inputs:
59
        versionSpec: 3.9
60
61
62
63
64
65
      displayName: Configure Python version
    - script: |
        sudo apt-get remove swig -y
        sudo apt-get install swig3.0 -y
        sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
      displayName: Install apt packages
Yuge Zhang's avatar
Yuge Zhang committed
66
67
68
69
70
71
72
73
    - task: Cache@2
      inputs:
        key: 'python | "$(Agent.OS)" | dependencies/*.txt'
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages
74
75
76
77
78
79
    - script: |
        set -e
        python -m pip install -U -r dependencies/setup.txt
        python -m pip install -r dependencies/develop.txt
        python -m pip install -r dependencies/required.txt
        python -m pip install -r dependencies/recommended.txt
80
        python -m pip install -r dependencies/required_extra.txt
81
        python -m pip install "typing-extensions>=3.10"  # pylint requires newer typing extension. Override requirements in tensorflow
82
83
84
85
86
87
88
89
90
91
92
93
94
      displayName: Install requirements
    - script: python -m pylint --rcfile pylintrc nni
      displayName: pylint
    - script: |
        set -e
        python -m flake8 nni --count --select=E9,F63,F72,F82 --show-source --statistics
        EXCLUDES=examples/trials/mnist-nas/*/mnist*.py,examples/trials/nas_cifar10/src/cifar10/general_child.py
        python -m flake8 examples --count --exclude=$EXCLUDES --select=E9,F63,F72,F82 --show-source --statistics
      displayName: flake8

  - job: typescript
    pool:
      vmImage: ubuntu-latest
95
96
    variables:
      YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
97
    steps:
98
99
100
101
    - task: NodeTool@0
      inputs:
        versionSpec: 16.3.0
      displayName: Configure Node.js version
102
103
104
105
106
107
108
    - task: Cache@2
      inputs:
        key: 'yarn | "$(Agent.OS)" | ts/**/yarn.lock, !**/node_modules/**'
        restoreKeys: |
          yarn | "$(Agent.OS)"
        path: $(YARN_CACHE_FOLDER)
      displayName: Cache yarn packages
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
    - script: |
        set -e
        cd ts/nni_manager
        yarn
        yarn eslint
      displayName: ESLint (NNI Manager)
    - script: |
        set -e
        cd ts/webui
        yarn
        yarn eslint
      displayName: ESLint (WebUI)


- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest
128
129
130
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
      YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
131
132
133
134

    steps:
    - task: UsePythonVersion@0
      inputs:
135
        versionSpec: 3.9
136
137
      displayName: Configure Python version

138
139
140
141
142
    - task: NodeTool@0
      inputs:
        versionSpec: 16.3.0
      displayName: Configure Node.js version

143
144
145
146
147
148
149
150
151
    - script: |
        sudo apt-get install -y pandoc
        sudo apt-get remove swig -y
        sudo apt-get install swig3.0 -y
        sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
      displayName: Install apt packages

    - task: Cache@2
      inputs:
152
        key: 'python | "$(Agent.OS)" | latest | dependencies/*.txt'
153
154
155
156
157
158
159
160
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages

    - task: Cache@2
      inputs:
161
        key: 'yarn | "$(Agent.OS)" | latest | ts/**/yarn.lock, !**/node_modules/**'
162
163
164
165
166
        restoreKeys: |
          yarn | "$(Agent.OS)"
        path: $(YARN_CACHE_FOLDER)
      displayName: Cache yarn packages

167
168
    - script: |
        set -e
169
170
        python -m pip install -U -r dependencies/setup.txt
        python -m pip install -r dependencies/develop.txt
171
172
173
174
175
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
      displayName: Install Python tools

    - script: |
        python setup.py develop
176
        mkdir -p coverage
177
178
179
180
      displayName: Install NNI

    - script: |
        set -e
181
        python -m pip install -r dependencies/recommended.txt
182
        python -m pip install -e .[PPOTuner,DNGO]
183
184
      displayName: Install extra dependencies

J-shang's avatar
J-shang committed
185
186
187
188
189
    # Need del later
    - script: |
        python test/vso_tools/interim_patch.py
      displayName: Torch utils tensorboard interim patch

190
191
192
    - script: |
        set -e
        cd test
193
        python -m pytest ut --cov-config=.coveragerc \
194
195
196
197
198
199
200
201
          --ignore=ut/compression/v1/test_pruners.py \
          --ignore=ut/compression/v1/test_compressor_tf.py \
          --ignore=ut/compression/v1/test_compressor_torch.py \
          --ignore=ut/compression/v1/test_model_speedup.py
        python -m pytest ut/compression/v1/test_pruners.py --cov-config=.coveragerc --cov-append
        python -m pytest ut/compression/v1/test_compressor_tf.py --cov-config=.coveragerc --cov-append
        python -m pytest ut/compression/v1/test_compressor_torch.py --cov-config=.coveragerc --cov-append
        python -m pytest ut/compression/v1/test_model_speedup.py --cov-config=.coveragerc --cov-append
202
        cp coverage.xml ../coverage/python.xml
203
204
205
206
207
208
      displayName: Python unit test

    - script: |
        set -e
        cd ts/nni_manager
        yarn test
209
        cp coverage/cobertura-coverage.xml ../../coverage/typescript.xml
210
211
      displayName: TypeScript unit test

212
213
214
215
216
217
218
219
220
221
    - task: PublishTestResults@2
      condition: succeededOrFailed()
      inputs:
        testResultsFiles: '$(System.DefaultWorkingDirectory)/**/test-*.xml'
        testRunTitle: 'Publish test results for Python $(python.version)'
      displayName: Publish test results

    - task: PublishCodeCoverageResults@1
      inputs:
        codeCoverageTool: Cobertura
222
        summaryFileLocation: coverage/*
223
224
      displayName: Publish code coverage results

225
226
227
228
229
230
231
232
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04
233
234
235
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
      YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
236
237
238
239

    steps:
    - task: UsePythonVersion@0
      inputs:
240
        versionSpec: 3.7
241
242
      displayName: Configure Python version

243
244
245
246
247
    - task: NodeTool@0
      inputs:
        versionSpec: 16.3.0
      displayName: Configure Node.js version

248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
    - script: |
        sudo apt-get install -y pandoc
        sudo apt-get remove swig -y
        sudo apt-get install swig3.0 -y
        sudo ln -s /usr/bin/swig3.0 /usr/bin/swig
      displayName: Install apt packages

    - task: Cache@2
      inputs:
        key: 'python | "$(Agent.OS)" | legacy | dependencies/*.txt'
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages

    - task: Cache@2
      inputs:
        key: 'yarn | "$(Agent.OS)" | legacy | ts/**/yarn.lock, !**/node_modules/**'
        restoreKeys: |
          yarn | "$(Agent.OS)"
        path: $(YARN_CACHE_FOLDER)
      displayName: Cache yarn packages

272
273
    - script: |
        set -e
274
275
276
277
278
279
280
281
282
283
        cd dependencies
        python -m pip install -U -r setup.txt
        # FIXME: Version resolving is a complete mess. Now it works magically.
        python -m pip install numpy==1.21.5
        python -m pip install -r develop.txt
        python -m pip install -r required.txt
        python -m pip install -r required_extra.txt
        python -m pip install -r recommended_legacy.txt
        python -m pip install numpy==1.21.5
        python -m pip install pytorch-lightning==1.5.9
284
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
285
      displayName: Install Python dependencies
286
287
288
289
290

    - script: |
        python setup.py develop
      displayName: Install NNI

J-shang's avatar
J-shang committed
291
292
293
    # Need del later
    - script: |
        set -e
J-shang's avatar
J-shang committed
294
295
        python test/vso_tools/interim_patch.py
      displayName: Torch utils tensorboard interim patch
J-shang's avatar
J-shang committed
296
297


298
299
300
301
302
303
304
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

    - script: |
        cd test
305
306
307
        python -m pytest ut --ignore=ut/retiarii/test_convert_basic.py \
          --ignore=ut/retiarii/test_convert_operators.py \
          --ignore=ut/retiarii/test_convert_pytorch.py
308
309
310
311
312
313
314
315
316
317
      displayName: Python unit test

    - script: |
        set -e
        cd ts/nni_manager
        yarn test
      displayName: TypeScript unit test

  - job: macos
    pool:
318
      vmImage: macOS-latest
319
320
321
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
      YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
322
    timeoutInMinutes: 90  # macos test need extra time
323
324
325
326

    steps:
    - task: UsePythonVersion@0
      inputs:
327
        versionSpec: 3.9
328
329
      displayName: Configure Python version

330
331
332
333
334
    - task: NodeTool@0
      inputs:
        versionSpec: 16.3.0
      displayName: Configure Node.js version

335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
    - script: |
        brew install swig@3
        rm -f /usr/local/bin/swig
        ln -s /usr/local/opt/swig\@3/bin/swig /usr/local/bin/swig
      displayName: Install brew packages

    - task: Cache@2
      inputs:
        key: 'python | "$(Agent.OS)" | dependencies/*.txt'
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages

    - task: Cache@2
      inputs:
        key: 'yarn | "$(Agent.OS)" | ts/**/yarn.lock, !**/node_modules/**'
        restoreKeys: |
          yarn | "$(Agent.OS)"
        path: $(YARN_CACHE_FOLDER)
      displayName: Cache yarn packages

358
359
    - script: |
        set -e
360
361
        python -m pip install -U -r dependencies/setup.txt
        python -m pip install -r dependencies/develop.txt
362
363
364
365
366
367
368
369
370
371
        echo "##vso[task.setvariable variable=PATH]${PATH}:${HOME}/.local/bin"
      displayName: Install Python tools

    - script: |
        python setup.py develop
      displayName: Install NNI

    - script: |
        set -e
        export CI=true
372
        (cd ts/nni_manager && yarn test --exclude test/core/nnimanager.test.ts)
373
374
375
376
      displayName: TypeScript unit test

    - script: |
        set -e
377
        python -m pip install -r dependencies/recommended.txt
98may's avatar
98may committed
378
        python -m pip install -e .[SMAC,BOHB,PPOTuner,DNGO]
379
380
      displayName: Install extra dependencies

J-shang's avatar
J-shang committed
381
382
383
384
385
386
    # Need del later
    - script: |
        set -e
        python test/vso_tools/interim_patch.py
      displayName: Torch utils tensorboard interim patch

387
388
389
390
391
392
393
394
395
396
397
398
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

  - job: windows
    pool:
399
      vmImage: windows-latest
400
401
402
    variables:
      PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip
      YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
403
    timeoutInMinutes: 120  # windows test need extra time
404
405
406
407

    steps:
    - task: UsePythonVersion@0
      inputs:
408
        versionSpec: 3.9
409
410
      displayName: Configure Python version

411
412
413
414
415
    - task: NodeTool@0
      inputs:
        versionSpec: 16.3.0
      displayName: Configure Node.js version

416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
    - task: Cache@2
      inputs:
        key: 'python | "$(Agent.OS)" | dependencies/*.txt'
        restoreKeys: | 
          python | "$(Agent.OS)"
          python
        path: $(PIP_CACHE_DIR)
      displayName: Cache pip packages

    - task: Cache@2
      inputs:
        key: 'yarn | "$(Agent.OS)" | ts/**/yarn.lock, !**/node_modules/**'
        restoreKeys: |
          yarn | "$(Agent.OS)"
        path: $(YARN_CACHE_FOLDER)
      displayName: Cache yarn packages

433
    - script: |
434
435
436
        set -e
        python -m pip install -U -r dependencies/setup.txt
        python -m pip install -r dependencies/develop.txt
437
438
439
440
441
442
443
      displayName: Install Python tools

    - script: |
        python setup.py develop --no-user
      displayName: Install NNI

    - script: |
444
        python -m pip install -r dependencies/recommended.txt
98may's avatar
98may committed
445
        python -m pip install -e .[DNGO]
446
447
      displayName: Install extra dependencies

J-shang's avatar
J-shang committed
448
449
450
451
452
453
    # Need del later
    - script: |
        set -e
        python test/vso_tools/interim_patch.py
      displayName: Torch utils tensorboard interim patch

454
455
456
457
458
459
460
461
462
463
464
465
466
467
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

    - script: |
        cd ts/nni_manager
        yarn test
      displayName: TypeScript unit test

    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test
liuzhe-lz's avatar
liuzhe-lz committed
468
469
470
471
472


trigger:
  branches:
    exclude: [ l10n_master ]