fast-test.yml 6.65 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
28
29
        # rstcheck -r source
      displayName: rstcheck (disabled for now)  # TODO: rstcheck

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

31
    - script: |
32
33
34
35
36
37
38
39
        cd docs
        make -e SPHINXOPTS="-W --keep-going -T -D language='zh'" html
      displayName: Sphinx sanity check (Chinese)

    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
40
41
42
43
44

  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
45
46
47
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
48
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
49

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

55
    - script: |
56
        python -m pylint --rcfile pylintrc nni
57
      displayName: pylint
58

59
60
61
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

  - job: typescript
    pool:
      vmImage: ubuntu-latest
    steps:
70
71
72
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
73
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
74

75
76
    - script: |
        set -e
77
78
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
79
      displayName: ESLint (NNI Manager)
80

81
82
    - script: |
        set -e
83
        yarn --cwd ts/webui
84
85
        yarn --cwd ts/webui sanity-check
      displayName: Sanity check (WebUI)
86

87

88
89
  # 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.
90
91
92
93
94
95
96
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
97
98
99
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
100
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
101
102
103

    - script: |
        python setup.py develop
104
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
105
106
107
108
      displayName: Install NNI

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

    - script: |
124
125
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
126
127
      displayName: TypeScript unit test

128
129
130
131
132
133
134
135
136
137
    - 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
138
        summaryFileLocation: coverage/*
139
140
      displayName: Publish code coverage results

141
142
143
144
145
146
147
148
149
150
    - 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:
151
152
153
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
154
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
155
156
157

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

    - script: |
174
        yarn --cwd ts/nni_manager test
175
176
      displayName: TypeScript unit test

177
  - job: windows
178
    pool:
179
      vmImage: windows-latest
180
181

    steps:
182
183
184
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
185
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
186
187

    - script: |
188
        python setup.py develop --no-user
189
190
191
192
193
194
195
      displayName: Install NNI

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

196
197
198
199
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

200
201
202
203
204
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

205
  - job: macos
206
    pool:
207
      vmImage: macOS-latest
208
209

    steps:
210
211
212
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
213
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
214
215

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

    - script: |
221
222
        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
223

224
225
226
227
228
229
230
231
232
    - 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