fast-test.yml 6.64 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
21
22
23
24
        rstcheck -r source \
          --ignore-directives automodule,autoclass,autofunction,cardlinkitem,codesnippetcard,argparse \
          --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
41
42
43
      displayName: Sphinx sanity check (Chinese)

    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
44
45
46
47
48

  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
49
50
51
52
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

53
    - script: |
54
55
56
57
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

58
    - script: |
59
        python -m pylint --rcfile pylintrc nni
60
      displayName: pylint
61

62
63
64
65
66
67
68
    - 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

69
70
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
71
      displayName: Type Check
72

73
74
75
76
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
77
78
79
80
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

81
82
    - script: |
        set -e
83
84
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
85
      displayName: ESLint (NNI Manager)
86

87
88
    - script: |
        set -e
89
        yarn --cwd ts/webui
90
91
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
92

93

94
95
  # 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.
96
97
98
99
100
101
102
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
103
104
105
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
106
107
108

    - script: |
        python setup.py develop
109
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
110
111
112
113
      displayName: Install NNI

    - script: |
        set -e
114
        mkdir -p coverage
115
        cd test
116
        python -m pytest ut --cov-config=.coveragerc \
117
118
119
120
121
122
123
124
          --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
125
        cp coverage.xml ../coverage/python.xml
126
127
128
      displayName: Python unit test

    - script: |
129
130
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
131
132
      displayName: TypeScript unit test

133
134
135
136
137
138
139
140
141
142
    - 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
143
        summaryFileLocation: coverage/*
144
145
      displayName: Publish code coverage results

146
147
148
149
150
151
152
153
154
155
    - 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:
156
157
158
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
159
160
161

    - script: |
        python setup.py develop
162
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
163
164
165
166
167
168
169
170
171
      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
172
173
174
        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
175
176
177
      displayName: Python unit test

    - script: |
178
        yarn --cwd ts/nni_manager test
179
180
      displayName: TypeScript unit test

181
  - job: windows
182
    pool:
183
      vmImage: windows-latest
184
    timeoutInMinutes: 75
185
186

    steps:
187
188
189
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
190
191

    - script: |
192
        python setup.py develop --no-user
193
194
195
196
197
198
199
      displayName: Install NNI

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

200
201
202
203
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

204
205
206
207
208
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

209
  - job: macos
210
    pool:
211
      vmImage: macOS-latest
212
213

    steps:
214
215
216
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
217
218

    - script: |
219
220
        python setup.py develop
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
221
222
223
      displayName: Install NNI

    - script: |
224
225
        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
226

227
228
229
230
231
232
233
234
235
    - 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