fast-test.yml 6.84 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
resources:
  repositories:
    - repository: azpfilter
      type: github
      name: microsoft/azure-pipeline-filter
      endpoint: github-filter-connection

variables:
16
  filter.modified.globs: 'pipelines/fast-test.yml,!.github/**,!docs/**,!examples/**'
J-shang's avatar
J-shang committed
17
18
19
  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
        cp coverage.xml ../coverage/python.xml
155
156
157
      displayName: Python unit test

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

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

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

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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