fast-test.yml 6.74 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: |
        cd docs
Yuge Zhang's avatar
Yuge Zhang committed
24
        rstcheck -r source \
Yuge Zhang's avatar
Yuge Zhang committed
25
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse,tabs \
Yuge Zhang's avatar
Yuge Zhang committed
26
27
28
          --ignore-roles githublink --ignore-substitutions release \
          --report warning
      displayName: rstcheck
29
30
31

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

35
    - script: |
36
        set -e
37
        cd docs
38
39
        sudo apt-get install -y gettext
        python tools/translation_patch.py
liuzhe-lz's avatar
liuzhe-lz committed
40
        sphinx-build -W --keep-going -T -q -D language=zh source build/html_zh
41
42
43
      displayName: Sphinx sanity check (Chinese)

    - script: |
44
        set -e
45
        cd docs
46
47
        make i18n
        git diff --exit-code source/locales
48
      displayName: Translation up-to-date
49

Yuge Zhang's avatar
Yuge Zhang committed
50
51
    - script: |
        cd docs
liuzhe-lz's avatar
liuzhe-lz committed
52
        sphinx-build -b linkcheck -W --keep-going -T -q source build/linkcheck
Yuge Zhang's avatar
Yuge Zhang committed
53
54
      displayName: External links integrity check

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

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

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

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

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

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

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

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

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

106

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

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

120
    - template: templates/install-nni.yml
121
122
123

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

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

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

156
157
    - script: |
        cd test
158
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
159
160
161
162
163
164
165
      displayName: Simple integration test

  - job: ubuntu_legacy
    pool:
      vmImage: ubuntu-18.04

    steps:
166
167
168
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
169

170
    - template: templates/install-nni.yml
171
172
173

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

    - script: |
        cd test
179
180
181
        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
182
183
184
      displayName: Python unit test

    - script: |
185
        yarn --cwd ts/nni_manager test
186
187
      displayName: TypeScript unit test

188
  - job: windows
189
    pool:
190
      vmImage: windows-latest
191
    timeoutInMinutes: 75
192
193

    steps:
194
195
196
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
197

198
199
200
    - template: templates/install-nni.yml
      parameters:
        user: false
201
202
203
204
205
206

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

207
208
209
210
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

211
212
    - script: |
        cd test
213
        python training_service/nnitest/run_tests.py --config training_service/config/pr_tests.yml
214
215
      displayName: Simple integration test

216
  - job: macos
217
    pool:
218
      vmImage: macOS-latest
219
220

    steps:
221
222
223
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
224

225
    - template: templates/install-nni.yml
226
227

    - script: |
228
229
        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
230

231
232
233
234
235
236
237
    - script: |
        cd test
        python -m pytest ut
      displayName: Python unit test

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