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

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

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

variables:
17
  filter.modified.globs: 'pipelines/fast-test.yml,!.github/**,!docs/**,!examples/**'
J-shang's avatar
J-shang committed
18
19
20
  filter.prbody.heading: '#### Test Options'
  filter.prbody.optionIndex: 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    - script: |
        set -e
152
        mkdir -p coverage
153
        cd test
154
        python -m pytest ut --cov-config=.coveragerc
155
        cp coverage.xml ../coverage/python.xml
156
157
158
      displayName: Python unit test

    - script: |
159
160
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
161
162
      displayName: TypeScript unit test

163
164
165
166
167
168
169
170
171
172
    - 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
173
        summaryFileLocation: coverage/*
174
175
      displayName: Publish code coverage results

176
177
    - script: |
        cd test
178
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
179
180
181
182
183
184
185
      displayName: Simple integration test

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04

    steps:
186
187
188
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
189

190
    - template: templates/install-nni.yml
191
192
193

    - script: |
        cd test
194
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
195
196
197
198
      displayName: Simple integration test

    - script: |
        cd test
199
200
201
        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
202
203
204
      displayName: Python unit test

    - script: |
205
        yarn --cwd ts/nni_manager test
206
207
      displayName: TypeScript unit test

208
  - job: windows
209
    pool:
210
      vmImage: windows-latest
211
    timeoutInMinutes: 75
212
213

    steps:
214
215
216
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
217

218
219
220
    - template: templates/install-nni.yml
      parameters:
        user: false
221
222
223
224
225
226

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

227
228
229
230
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

231
232
    - script: |
        cd test
233
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
234
235
      displayName: Simple integration test

236
  - job: macos
237
    pool:
238
      vmImage: macOS-latest
239
240

    steps:
241
242
243
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
244

245
    - template: templates/install-nni.yml
246
247

    - script: |
248
249
        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
250

251
252
253
254
255
256
257
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

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