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

    - script: |
        cd docs
31
        make -e SPHINXOPTS="-W --keep-going -T -q" html
32
      displayName: Sphinx sanity check
33

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

    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
47
48
49
50
51

  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
52
53
54
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
55
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
56

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

62
    - script: |
63
        python -m pylint --rcfile pylintrc nni
64
      displayName: pylint
65

66
67
68
69
70
71
72
    - 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

73
74
    - script: |
        python -m pyright nni
liuzhe-lz's avatar
liuzhe-lz committed
75
      displayName: Type Check
76

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

86
87
    - script: |
        set -e
88
89
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
90
      displayName: ESLint (NNI Manager)
91

92
93
    - script: |
        set -e
94
        yarn --cwd ts/webui
95
96
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
97

98

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

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

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

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

    - script: |
135
136
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
137
138
      displayName: TypeScript unit test

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

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

    - script: |
        python setup.py develop
169
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
170
171
172
173
174
175
176
177
178
      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
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
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
198
199

    - script: |
200
        python setup.py develop --no-user
201
202
203
204
205
206
207
      displayName: Install NNI

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

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

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

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

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

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

    - script: |
233
234
        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
235

236
237
238
239
240
241
242
243
244
    - 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