fast-test.yml 6.71 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
variables:
10
  filter.modified.globs: 'pipelines/fast-test.yml,!.github/**,!docs/**,!examples/**'
J-shang's avatar
J-shang committed
11
12
13
  filter.prbody.heading: '#### Test Options'
  filter.prbody.optionIndex: 0

14
15
16
stages:
- stage: lint
  jobs:
Yuge Zhang's avatar
Yuge Zhang committed
17
18
19
20
21
22
23
24

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

25
26
27
28
  - job: docs
    pool:
      vmImage: ubuntu-latest
    steps:
29
30
31
32
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

33
34
    - script: |
        cd docs
Yuge Zhang's avatar
Yuge Zhang committed
35
        rstcheck -r source \
36
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse,tabs,youtube,image-sg \
Yuge Zhang's avatar
Yuge Zhang committed
37
          --ignore-roles githublink --ignore-substitutions release \
38
          --report-level warning
Yuge Zhang's avatar
Yuge Zhang committed
39
      displayName: rstcheck
40
41
42

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

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

    - script: |
55
        set -e
56
        cd docs
57
58
        make i18n
        git diff --exit-code source/locales
59
      displayName: Translation up-to-date
60

Yuge Zhang's avatar
Yuge Zhang committed
61
62
    - script: |
        cd docs
liuzhe-lz's avatar
liuzhe-lz committed
63
        sphinx-build -b linkcheck -W --keep-going -T -q source build/linkcheck
Yuge Zhang's avatar
Yuge Zhang committed
64
65
      displayName: External links integrity check

66
67
68
69
  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
70
71
72
73
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

74
    - script: |
75
76
77
78
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

79
80
81
    - script: python test/vso_tools/trigger_import.py
      displayName: Trigger import

82
    - script: |
83
        python -m pylint --rcfile pylintrc nni
84
      displayName: pylint
85

86
87
88
89
90
91
92
    - 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

93
94
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
95
      displayName: Type Check
96

97
98
99
100
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
101
102
103
104
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

105
106
    - script: |
        set -e
107
108
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
109
      displayName: ESLint (NNI Manager)
110

111
112
    - script: |
        set -e
113
        yarn --cwd ts/webui
114
115
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
116

J-shang's avatar
J-shang committed
117
118
119
120
121
122
123
- stage: filter
  jobs:
  - job: check
    pool:
      vmImage: ubuntu-latest
    steps:
    - template: templates/stage-filter.yml
124

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

    steps:
137
138
139
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
140

141
    - template: templates/install-nni.yml
142
143
144

    - script: |
        set -e
145
        mkdir -p coverage
146
        cd test
147
        python -m pytest ut --cov-config=.coveragerc
148
        cp coverage.xml ../coverage/python.xml
149
150
151
      displayName: Python unit test

    - script: |
152
153
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
154
155
      displayName: TypeScript unit test

156
157
158
159
160
161
162
163
164
165
    - 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
166
        summaryFileLocation: coverage/*
167
168
      displayName: Publish code coverage results

169
170
    - script: |
        cd test
171
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
172
173
174
175
176
177
178
      displayName: Simple integration test

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04

    steps:
179
180
181
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
182

183
    - template: templates/install-nni.yml
184
185
186

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

    - script: |
        cd test
192
193
194
        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
195
196
197
      displayName: Python unit test

    - script: |
198
        yarn --cwd ts/nni_manager test
199
200
      displayName: TypeScript unit test

201
  - job: windows
202
    pool:
203
      vmImage: windows-latest
204
    timeoutInMinutes: 75
205
206

    steps:
207
208
209
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
210

211
212
213
    - template: templates/install-nni.yml
      parameters:
        user: false
214
215
216
217
218
219

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

220
221
222
223
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

224
225
    - script: |
        cd test
226
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
227
228
      displayName: Simple integration test

229
  - job: macos
230
    pool:
231
      vmImage: macOS-latest
232
233

    steps:
234
235
236
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
237

238
    - template: templates/install-nni.yml
239
240

    - script: |
241
242
        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
243

244
245
246
247
248
249
250
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

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