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

3
4
5
stages:
- stage: lint
  jobs:
Yuge Zhang's avatar
Yuge Zhang committed
6
7
8
9
10
11
12
13

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

14
15
16
17
  - job: docs
    pool:
      vmImage: ubuntu-latest
    steps:
18
19
20
21
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

22
23
    - script: |
        sudo apt-get install -y pandoc
24
25
      displayName: Install pandoc

26
27
    - script: |
        cd docs
Yuge Zhang's avatar
Yuge Zhang committed
28
        rstcheck -r source \
Yuge Zhang's avatar
Yuge Zhang committed
29
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse,tabs \
Yuge Zhang's avatar
Yuge Zhang committed
30
31
32
          --ignore-roles githublink --ignore-substitutions release \
          --report warning
      displayName: rstcheck
33
34
35

    - script: |
        cd docs
36
        make -e SPHINXOPTS="-W --keep-going -T -q" html
37
      displayName: Sphinx sanity check
38

39
    - script: |
40
        set -e
41
        cd docs
42
43
44
        rm -rf build
        sudo apt-get install -y gettext
        python tools/translation_patch.py
45
        make -e SPHINXOPTS="-W --keep-going -T -q -D language='zh'" html
46
47
48
      displayName: Sphinx sanity check (Chinese)

    - script: |
49
        set -e
50
        cd docs
51
52
53
        rm -rf build
        make i18n
        git diff --exit-code source/locales
54
      displayName: Translation up-to-date
55

Yuge Zhang's avatar
Yuge Zhang committed
56
57
    - script: |
        cd docs
58
        rm -rf build
Yuge Zhang's avatar
Yuge Zhang committed
59
60
61
        make -e SPHINXOPTS="-W -T -b linkcheck -q --keep-going" html
      displayName: External links integrity check

62
63
64
65
  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
66
67
68
69
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

70
    - script: |
71
72
73
74
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

75
76
77
    - script: python test/vso_tools/trigger_import.py
      displayName: Trigger import

78
    - script: |
79
        python -m pylint --rcfile pylintrc nni
80
      displayName: pylint
81

82
83
84
85
86
87
88
    - 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

89
90
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
91
      displayName: Type Check
92

93
94
95
96
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
97
98
99
100
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

101
102
    - script: |
        set -e
103
104
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
105
      displayName: ESLint (NNI Manager)
106

107
108
    - script: |
        set -e
109
        yarn --cwd ts/webui
110
111
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
112

113

114
115
  # 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.
116
117
118
119
120
121
122
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
123
124
125
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
126

127
    - template: templates/install-nni.yml
128
129
130

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

    - script: |
146
147
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
148
149
      displayName: TypeScript unit test

150
151
152
153
154
155
156
157
158
159
    - 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
160
        summaryFileLocation: coverage/*
161
162
      displayName: Publish code coverage results

163
164
165
166
167
168
169
170
171
172
    - 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:
173
174
175
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
176

177
    - template: templates/install-nni.yml
178
179
180
181
182
183
184
185

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

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

    - script: |
192
        yarn --cwd ts/nni_manager test
193
194
      displayName: TypeScript unit test

195
  - job: windows
196
    pool:
197
      vmImage: windows-latest
198
    timeoutInMinutes: 75
199
200

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

205
206
207
    - template: templates/install-nni.yml
      parameters:
        user: false
208
209
210
211
212
213

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

214
215
216
217
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

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

223
  - job: macos
224
    pool:
225
      vmImage: macOS-latest
226
227

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

232
    - template: templates/install-nni.yml
233
234

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

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