fast-test.yml 7.45 KB
Newer Older
1
trigger: none
2

Yuge Zhang's avatar
Yuge Zhang committed
3
4
5
6
7
schedules:
- cron: 0 16 * * *
  branches:
    include: [ master ]

J-shang's avatar
J-shang committed
8
9
10
11
12
13
14
15
16
17
18
19
resources:
  repositories:
    - repository: azpfilter
      type: github
      name: microsoft/azure-pipeline-filter
      endpoint: github-filter-connection

variables:
  filter.modified.globs: '!.github/**,!docs/**,!examples/**'
  filter.prbody.heading: '#### Test Options'
  filter.prbody.optionIndex: 0

20
21
22
stages:
- stage: lint
  jobs:
Yuge Zhang's avatar
Yuge Zhang committed
23
24
25
26
27
28
29
30

  - job: copyright
    pool:
      vmImage: ubuntu-latest
    steps:
    - script: python test/vso_tools/copyright_check.py
      displayName: Check copyright header

31
32
33
34
  - job: docs
    pool:
      vmImage: ubuntu-latest
    steps:
35
36
37
38
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

39
40
    - script: |
        cd docs
Yuge Zhang's avatar
Yuge Zhang committed
41
        rstcheck -r source \
42
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse,tabs,youtube \
Yuge Zhang's avatar
Yuge Zhang committed
43
          --ignore-roles githublink --ignore-substitutions release \
44
          --report-level warning
Yuge Zhang's avatar
Yuge Zhang committed
45
      displayName: rstcheck
46
47
48

    - script: |
        cd docs
liuzhe-lz's avatar
liuzhe-lz committed
49
        sphinx-build -W --keep-going -T -q source build/html
50
      displayName: Sphinx sanity check
51

52
    - script: |
53
        set -e
54
        cd docs
55
56
        sudo apt-get install -y gettext
        python tools/translation_patch.py
liuzhe-lz's avatar
liuzhe-lz committed
57
        sphinx-build -W --keep-going -T -q -D language=zh source build/html_zh
58
59
60
      displayName: Sphinx sanity check (Chinese)

    - script: |
61
        set -e
62
        cd docs
63
64
        make i18n
        git diff --exit-code source/locales
65
      displayName: Translation up-to-date
66

Yuge Zhang's avatar
Yuge Zhang committed
67
68
    - script: |
        cd docs
liuzhe-lz's avatar
liuzhe-lz committed
69
        sphinx-build -b linkcheck -W --keep-going -T -q source build/linkcheck
Yuge Zhang's avatar
Yuge Zhang committed
70
71
      displayName: External links integrity check

72
73
74
75
  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
76
77
78
79
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

80
    - script: |
81
82
83
84
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

85
86
87
    - script: python test/vso_tools/trigger_import.py
      displayName: Trigger import

88
    - script: |
89
        python -m pylint --rcfile pylintrc nni
90
      displayName: pylint
91

92
93
94
95
96
97
98
    - 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

99
100
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
101
      displayName: Type Check
102

103
104
105
106
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
107
108
109
110
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

111
112
    - script: |
        set -e
113
114
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
115
      displayName: ESLint (NNI Manager)
116

117
118
    - script: |
        set -e
119
        yarn --cwd ts/webui
120
121
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
122

J-shang's avatar
J-shang committed
123
124
125
126
127
128
129
- stage: filter
  jobs:
  - job: check
    pool:
      vmImage: ubuntu-latest
    steps:
    - template: templates/stage-filter.yml
130

131
132
  # 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.
133
- stage: test
J-shang's avatar
J-shang committed
134
135
136
  dependsOn: lint
  # dependencies.$(StageName).outputs['$(JobName).$(TaskName).$(VariableName)']
  condition: and(succeeded(), ne(dependencies.filter.outputs['check.execution.skipsubsequent'], 'true'))
137
138
139
140
141
142
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
143
144
145
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
146

147
    - template: templates/install-nni.yml
148
149
150

    - script: |
        set -e
151
        mkdir -p coverage
152
        cd test
153
        python -m pytest ut --cov-config=.coveragerc \
154
155
156
157
158
159
160
161
          --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
162
        cp coverage.xml ../coverage/python.xml
163
164
165
      displayName: Python unit test

    - script: |
166
167
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
168
169
      displayName: TypeScript unit test

170
171
172
173
174
175
176
177
178
179
    - 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
180
        summaryFileLocation: coverage/*
181
182
      displayName: Publish code coverage results

183
184
    - script: |
        cd test
185
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
186
187
188
189
190
191
192
      displayName: Simple integration test

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04

    steps:
193
194
195
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
196

197
    - template: templates/install-nni.yml
198
199
200

    - script: |
        cd test
201
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
202
203
204
205
      displayName: Simple integration test

    - script: |
        cd test
206
207
208
        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
209
210
211
      displayName: Python unit test

    - script: |
212
        yarn --cwd ts/nni_manager test
213
214
      displayName: TypeScript unit test

215
  - job: windows
216
    pool:
217
      vmImage: windows-latest
218
    timeoutInMinutes: 75
219
220

    steps:
221
222
223
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
224

225
226
227
    - template: templates/install-nni.yml
      parameters:
        user: false
228
229
230
231
232
233

    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

234
235
236
237
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

238
239
    - script: |
        cd test
240
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
241
242
      displayName: Simple integration test

243
  - job: macos
244
    pool:
245
      vmImage: macOS-latest
246
247

    steps:
248
249
250
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
251

252
    - template: templates/install-nni.yml
253
254

    - script: |
255
256
        CI=true yarn --cwd ts/nni_manager test --exclude test/core/nnimanager.test.ts
      displayName: TypeScript unit test
J-shang's avatar
J-shang committed
257

258
259
260
261
262
263
264
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

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