fast-test.yml 6.47 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
23
24
    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
25

26
27
28
29
30
31
32
33
34
    - script: |
        cd docs/en_US
        sphinx-build -M html . _build -W --keep-going -T
      displayName: Sphinx  # TODO: rstcheck

  - job: python
    pool:
      vmImage: ubuntu-latest
    steps:
35
36
37
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
38
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
39

40
    - script: |
41
42
43
44
        # pylint requires newer typing extension. Override requirements in tensorflow
        python -m pip install "typing-extensions>=3.10"
      displayName: Resolve dependency version

45
    - script: |
46
        python -m pylint --rcfile pylintrc nni
47
      displayName: pylint
48

49
50
51
52
53
54
55
56
57
58
59
    - 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:
60
61
62
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
63
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
64

65
66
    - script: |
        set -e
67
68
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
69
      displayName: ESLint (NNI Manager)
70

71
72
    - script: |
        set -e
73
74
        yarn --cwd ts/webui
        yarn --cwd ts/webui eslint
75
76
      displayName: ESLint (WebUI)

77
78
79
80
    - script: |
        yarn --cwd ts/webui tsc
      displayName: Type Check (WebUI)

81

82
83
  # 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.
84
85
86
87
88
89
90
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
91
92
93
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
94
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
95
96
97

    - script: |
        python setup.py develop
98
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
99
100
101
102
      displayName: Install NNI

    - script: |
        set -e
103
        mkdir -p coverage
104
        cd test
105
        python -m pytest ut --cov-config=.coveragerc \
106
107
108
109
110
111
112
113
          --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
114
        cp coverage.xml ../coverage/python.xml
115
116
117
      displayName: Python unit test

    - script: |
118
119
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
120
121
      displayName: TypeScript unit test

122
123
124
125
126
127
128
129
130
131
    - 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
132
        summaryFileLocation: coverage/*
133
134
      displayName: Publish code coverage results

135
136
137
138
139
140
141
142
143
144
    - 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:
145
146
147
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
148
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
149
150
151

    - script: |
        python setup.py develop
152
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
153
154
155
156
157
158
159
160
161
      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
162
163
164
        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
165
166
167
      displayName: Python unit test

    - script: |
168
        yarn --cwd ts/nni_manager test
169
170
      displayName: TypeScript unit test

171
  - job: windows
172
    pool:
173
      vmImage: windows-latest
174
175

    steps:
176
177
178
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
179
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
180
181

    - script: |
182
        python setup.py develop --no-user
183
184
185
186
187
188
189
      displayName: Install NNI

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

190
191
192
193
    - script: |
        yarn --cwd ts/nni_manager test
      displayName: TypeScript unit test

194
195
196
197
198
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

199
  - job: macos
200
    pool:
201
      vmImage: macOS-latest
202
203

    steps:
204
205
206
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
207
        useCache: ${{ eq('$(USE_CACHE)', 'true') }}
208
209

    - script: |
210
211
        python setup.py develop
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
212
213
214
      displayName: Install NNI

    - script: |
215
216
        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
217

218
219
220
221
222
223
224
225
226
    - 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