fast-test.yml 6.88 KB
Newer Older
1
2
3
trigger:
  branches:
    exclude: [ l10n_master ]
4

5
6
7
8
9
10
11
stages:
- stage: lint
  jobs:
  - job: docs
    pool:
      vmImage: ubuntu-latest
    steps:
12
13
14
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
15
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
16

17
18
    - script: |
        sudo apt-get install -y pandoc
19
20
      displayName: Install pandoc

21
22
    - script: |
        cd docs
23
24
25
26
27
        # rstcheck -r source
      displayName: rstcheck (disabled for now)  # TODO: rstcheck

    - 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
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
52
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
53

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

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

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

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

74
75
76
77
  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
78
79
80
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
81
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
82

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

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

95

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

    steps:
105
106
107
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
108
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
109
110
111

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

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

    - script: |
132
133
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
134
135
      displayName: TypeScript unit test

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

149
150
151
152
153
154
155
156
157
158
    - 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:
159
160
161
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
162
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
163
164
165

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

    - script: |
182
        yarn --cwd ts/nni_manager test
183
184
      displayName: TypeScript unit test

185
  - job: windows
186
    pool:
187
      vmImage: windows-latest
188
    timeoutInMinutes: 75
189
190

    steps:
191
192
193
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
194
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
195
196

    - script: |
197
        python setup.py develop --no-user
198
199
200
201
202
203
204
      displayName: Install NNI

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

205
206
207
208
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

209
210
211
212
213
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

214
  - job: macos
215
    pool:
216
      vmImage: macOS-latest
217
218

    steps:
219
220
221
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
222
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
223
224

    - script: |
225
226
        python setup.py develop
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
227
228
229
      displayName: Install NNI

    - script: |
230
231
        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
232

233
234
235
236
237
238
239
240
241
    - 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