This commit is contained in:
Jianjie Liu (MAIDAP) 2021-01-26 18:23:01 -05:00
Родитель 36875705b4
Коммит b67c6b34ab
7 изменённых файлов: 102 добавлений и 64 удалений

Просмотреть файл

@ -1,10 +1,34 @@
name: $(Date:yyyyMMdd).$(Rev:r)
strategy:
matrix:
linux_x64_py3.6:
imageName: 'ubuntu-18.04'
pyVersion: '3.6'
stages:
- stage: static_analysis
jobs:
- job: flake8_linux_py36
pool:
vmImage: 'ubuntu-latest'
steps:
- template: templates/run-linter.yml
parameters:
pyVersion: '3.6'
- stage: run_tests
dependsOn: static_analysis
pool:
vmImage: 'ubuntu-18.04'
jobs:
- template: templates/run-tests-on-multiple-py-versions.yml
parameters:
pyVersions: ['3.6', '3.7']
testTypes: ['fast', 'slow']
# strategy:
# matrix:
# linux_x64_py3.6:
# imageName: 'ubuntu-18.04'
# pyVersion: '3.6'
# windows_x64_py3.6:
# imageName: 'windows-2019'
@ -19,31 +43,28 @@ strategy:
# imageName: 'ubuntu-16.04'
# pyVersion: '3.5'
pool:
vmImage: '$(imageName)'
steps:
- template: templates/run-linter.yml
parameters:
pyVersion: $(python.version)
# pool:
# vmImage: '$(imageName)'
- template: templates/run-tests.yml
parameters:
testType: 'unit'
imageName: $(imageName)
pyVersion: $(python.version)
- template: templates/run-tests.yml
parameters:
testType: 'slow'
imageName: $(imageName)
pyVersion: $(python.version)
# steps:
# - template: templates/run-linter.yml
# parameters:
# pyVersion: $(python.version)
# - template: templates/run-tests.yml
# parameters:
# testType: 'azure'
# testType: 'fast'
# imageName: $(imageName)
# pyVersion: $(python.version)
# - template: templates/run-tests.yml
# parameters:
# testType: 'slow'
# skipInstall: true
# imageName: $(imageName)
# pyVersion: $(python.version)
# - template: templates/publish-cov.yml
# - bash: |
# python setup.py bdist_wheel --build-number $(Build.BuildNumber) --dist-dir dist

Просмотреть файл

@ -0,0 +1,8 @@
# Assume a python version is enabled with "UsePythonVersion@0" task
steps:
- bash: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Install dependencies'

Просмотреть файл

@ -0,0 +1,14 @@
steps:
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit/*.xml'
searchFolder: $(Build.SourcesDirectory)
testRunTitle: $(imageName)_$(pyVersion) Build
buildPlatform: $(imageName)
displayName: 'Publish unit test report'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.xml'

Просмотреть файл

@ -2,15 +2,15 @@
parameters:
- name: pyVersion
type: string
default: 3.6
default: '3.6'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pyVersion)'
versionSpec: ${{ parameters.pyVersion }}
addToPath: true
architecture: 'x64'
displayName: 'Use Python $(pyVersion)'
displayName: 'Use Python ${{ parameters.pyVersion }}'
- bash: |
python -m pip install --upgrade pip setuptools wheel

Просмотреть файл

@ -0,0 +1,28 @@
parameters:
- name: pyVersions
type: object
default: ['3.6', '3.7', '3.8']
- name: testTypes
type: object
default: ['fast', 'slow']
jobs:
- ${{ each pyVersion in parameters.pyVersions }}:
- job: run_tests_py${{ replace(pyVersion, '.', '_') }}
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: ${{pyVersion}}
addToPath: true
architecture: 'x64'
displayName: 'Use Python ${{pyVersion}}'
- template: install-dependencies.yml
- ${{ each testType in parameters.testTypes }}:
- template: run-tests.yml
parameters:
testType: ${{testType}}
- template: publish-cov.yml

Просмотреть файл

@ -1,40 +1,21 @@
# Template for running tests on multiple Python versions and platforms
parameters:
- name: imageName
type: string
- name: testType
type: string
default: all
values:
- slow
- azure
- unit
- fast
- all
- name: pyVersion
type: string
default: 3.6
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pyVersion)'
addToPath: true
architecture: 'x64'
displayName: 'Use Python $(pyVersion)'
- bash: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements.txt
python -m pip install -r requirements-dev.txt
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Install dependencies'
- bash: |
if [[ '${{parameters.testType}}' == 'all' ]]
then
tox -e py
elif [[ '${{parameters.testType}}' == 'unit' ]]
elif [[ '${{parameters.testType}}' == 'fast' ]]
then
tox -e py -- -m "not slow and not azure"
else
@ -46,18 +27,4 @@ steps:
COGNITIVE_SERVICE_KEY: $(COGNITIVE_SERVICE_KEY)
COMPUTER_VISION_SUBSCRIPTION_KEY: $(COMPUTER_VISION_SUBSCRIPTION_KEY)
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Test via tox'
- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit/*.xml'
searchFolder: $(Build.SourcesDirectory)
testRunTitle: $(imageName)_$(pyVersion) Build
buildPlatform: $(imageName)
displayName: 'Publish unit test report'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Build.SourcesDirectory)/**/coverage.xml'
displayName: 'Running (${{parameters.testType}}) Tests'

Просмотреть файл

@ -45,7 +45,7 @@ markers =
testpaths =
tests
addopts =
-rsx --cov=genalog --cov-report=html --cov-report=term-missing --cov-report=xml --junitxml=junit/test-results.xml
-rsx --cov-append --cov=genalog --cov-report=html --cov-report=term-missing --cov-report=xml --junitxml=junit/test-results.xml
[flake8]