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

3
4
5
6
7
8
9
stages:
- stage: lint
  jobs:
  - job: docs
    pool:
      vmImage: ubuntu-latest
    steps:
10
11
12
13
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

14
15
    - script: |
        sudo apt-get install -y pandoc
16
17
      displayName: Install pandoc

18
19
    - script: |
        cd docs
Yuge Zhang's avatar
Yuge Zhang committed
20
        rstcheck -r source \
Yuge Zhang's avatar
Yuge Zhang committed
21
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse,tabs \
Yuge Zhang's avatar
Yuge Zhang committed
22
23
24
          --ignore-roles githublink --ignore-substitutions release \
          --report warning
      displayName: rstcheck
25
26
27

    - script: |
        cd docs
28
        make -e SPHINXOPTS="-W --keep-going -T -q" html
29
      displayName: Sphinx sanity check
30

31
    - script: |
32
        set -e
33
        cd docs
34
35
36
        rm -rf build
        sudo apt-get install -y gettext
        python tools/translation_patch.py
37
        make -e SPHINXOPTS="-W --keep-going -T -q -D language='zh'" html
38
39
40
      displayName: Sphinx sanity check (Chinese)

    - script: |
41
        set -e
42
        cd docs
43
44
45
        rm -rf build
        make i18n
        git diff --exit-code source/locales
46
      displayName: Translation up-to-date
47

Yuge Zhang's avatar
Yuge Zhang committed
48
49
    - script: |
        cd docs
50
        rm -rf build
Yuge Zhang's avatar
Yuge Zhang committed
51
52
53
        make -e SPHINXOPTS="-W -T -b linkcheck -q --keep-going" html
      displayName: External links integrity check

54
55
56
57
  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
58
59
60
61
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

62
    - script: |
63
64
65
66
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

67
68
69
    - script: python test/vso_tools/trigger_import.py
      displayName: Trigger import

70
    - script: |
71
        python -m pylint --rcfile pylintrc nni
72
      displayName: pylint
73

74
75
76
77
78
79
80
    - 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

81
82
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
83
      displayName: Type Check
84

85
86
87
88
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
89
90
91
92
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

93
94
    - script: |
        set -e
95
96
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
97
      displayName: ESLint (NNI Manager)
98

99
100
    - script: |
        set -e
101
        yarn --cwd ts/webui
102
103
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
104

105

106
107
  # 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.
108
109
110
111
112
113
114
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
115
116
117
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
118
119
120

    - script: |
        python setup.py develop
121
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
122
123
124
125
      displayName: Install NNI

    - script: |
        set -e
126
        mkdir -p coverage
127
        cd test
128
        python -m pytest ut --cov-config=.coveragerc \
129
130
131
132
133
134
135
136
          --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
137
        cp coverage.xml ../coverage/python.xml
138
139
140
      displayName: Python unit test

    - script: |
141
142
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
143
144
      displayName: TypeScript unit test

145
146
147
148
149
150
151
152
153
154
    - 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
155
        summaryFileLocation: coverage/*
156
157
      displayName: Publish code coverage results

158
159
160
161
162
163
164
165
166
167
    - 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

    steps:
168
169
170
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
171
172
173

    - script: |
        python setup.py develop
174
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
175
176
177
178
179
180
181
182
183
      displayName: Install NNI

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

    - script: |
        cd test
184
185
186
        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
187
188
189
      displayName: Python unit test

    - script: |
190
        yarn --cwd ts/nni_manager test
191
192
      displayName: TypeScript unit test

193
  - job: windows
194
    pool:
195
      vmImage: windows-latest
196
    timeoutInMinutes: 75
197
198

    steps:
199
200
201
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
202
203

    - script: |
204
        python setup.py develop --no-user
205
206
207
208
209
210
211
      displayName: Install NNI

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

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

216
217
218
219
220
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

221
  - job: macos
222
    pool:
223
      vmImage: macOS-latest
224
225

    steps:
226
227
228
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
229
230

    - script: |
231
232
        python setup.py develop
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
233
234
235
      displayName: Install NNI

    - script: |
236
237
        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
238

239
240
241
242
243
244
245
246
247
    - 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