fast-test.yml 6.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
15
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

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

20
21
22
23
    - script: |
        cd docs
        python tools/chineselink.py check
      displayName: Translation up-to-date
24

25
26
27
28
29
30
31
32
33
    - 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:
34
35
36
37
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

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

43
    - script: |
44
        python -m pylint --rcfile pylintrc nni
45
      displayName: pylint
46

47
48
49
50
51
52
53
54
55
56
57
    - 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:
58
59
60
61
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest

62
63
    - script: |
        set -e
64
65
        yarn --cwd ts/nni_manager
        yarn --cwd ts/nni_manager eslint
66
      displayName: ESLint (NNI Manager)
67

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


75
76
  # 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.
77
78
79
80
81
82
83
- stage: test
  jobs:
  - job: ubuntu_latest
    pool:
      vmImage: ubuntu-latest

    steps:
84
85
86
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-latest
87
88
89

    - script: |
        python setup.py develop
90
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
91
92
93
94
      displayName: Install NNI

    - script: |
        set -e
95
        mkdir -p coverage
96
        cd test
97
        python -m pytest ut --cov-config=.coveragerc \
98
99
100
101
102
103
104
105
          --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
106
        cp coverage.xml ../coverage/python.xml
107
108
109
      displayName: Python unit test

    - script: |
110
111
        yarn --cwd ts/nni_manager test
        cp ts/nni_manager/coverage/cobertura-coverage.xml coverage/typescript.xml
112
113
      displayName: TypeScript unit test

114
115
116
117
118
119
120
121
122
123
    - 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
124
        summaryFileLocation: coverage/*
125
126
      displayName: Publish code coverage results

127
128
129
130
131
132
133
134
135
136
    - 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:
137
138
139
    - template: templates/install-dependencies.yml
      parameters:
        platform: ubuntu-legacy
140
141
142

    - script: |
        python setup.py develop
143
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
144
145
146
147
148
149
150
151
152
      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
153
154
155
        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
156
157
158
      displayName: Python unit test

    - script: |
159
        yarn --cwd ts/nni_manager test
160
161
      displayName: TypeScript unit test

162
  - job: windows
163
    pool:
164
      vmImage: windows-latest
165
166

    steps:
167
168
169
    - template: templates/install-dependencies.yml
      parameters:
        platform: windows
170
171

    - script: |
172
        python setup.py develop --no-user
173
174
175
176
177
178
179
      displayName: Install NNI

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

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

184
185
186
187
188
    - script: |
        cd test
        python nni_test/nnitest/run_tests.py --config config/pr_tests.yml
      displayName: Simple integration test

189
  - job: macos
190
    pool:
191
      vmImage: macOS-latest
192
193

    steps:
194
195
196
    - template: templates/install-dependencies.yml
      parameters:
        platform: macos
197
198

    - script: |
199
200
        python setup.py develop
        echo "##vso[task.setvariable variable=PATH]${HOME}/.local/bin:${PATH}"
201
202
203
      displayName: Install NNI

    - script: |
204
205
        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
206

207
208
209
210
211
212
213
214
215
    - 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