This commit is contained in:
Jianjie Liu (MAIDAP) 2021-01-26 17:41:29 -05:00
Родитель cc31cf5866
Коммит 7ae1d6c244
3 изменённых файлов: 145 добавлений и 0 удалений

58
devops/pr-gate-os.yml Normal file
Просмотреть файл

@ -0,0 +1,58 @@
name: $(Date:yyyyMMdd).$(Rev:r)
strategy:
matrix:
linux_x64_py3.6:
imageName: 'ubuntu-18.04'
pyVersion: '3.6'
# windows_x64_py3.6:
# imageName: 'windows-2019'
# pyVersion: '3.6'
# macos_x64_py3.6:
# imageName: 'macOS-10.14'
# pyVersion: '3.6'
# To build using more python versions follow the syntax below:
# linux_x64_py3.5:
# imageName: 'ubuntu-16.04'
# pyVersion: '3.5'
pool:
vmImage: '$(imageName)'
steps:
- template: templates/run-linter.yml
parameters:
pyVersion: $(python.version)
- template: templates/run-tests.yml
parameters:
testType: 'unit'
imageName: $(imageName)
pyVersion: $(python.version)
# - template: templates/run-tests.yml
# parameters:
# testType: 'azure'
# imageName: $(imageName)
# pyVersion: $(python.version)
# - bash: |
# python setup.py bdist_wheel --build-number $(Build.BuildNumber) --dist-dir dist
# workingDirectory: $(Build.SourcesDirectory)
# displayName: 'Building wheel package'
# - bash: |
# mkdir $BUILD_ARTIFACTSTAGINGDIRECTORY/py$(python.version)/
# cp -r dist/* $BUILD_ARTIFACTSTAGINGDIRECTORY/py$(python.version)/
# workingDirectory: $(Build.SourcesDirectory)
# displayName: 'Copying builds to artifact staging dir'
# - task: PublishBuildArtifacts@1
# inputs:
# PathtoPublish: $(Build.ArtifactStagingDirectory)
# ArtifactName: genalog
# publishLocation: 'Container'
# displayName: 'Publish build as artifacts'

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

@ -0,0 +1,24 @@
# Template for running linter and other static analysis tools on the code
parameters:
- 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-dev.txt
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Install flake8 and other dev dependencies'
- bash: |
tox -e flake8
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Run Linter (flake8)'

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

@ -0,0 +1,63 @@
# 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
- 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' ]]
then
tox -e py -- -m "not slow and not azure"
else
tox -e py -- -m "${{parameters.testType}}"
fi
env:
BLOB_KEY : $(BLOB_KEY)
SEARCH_SERVICE_KEY: $(SEARCH_SERVICE_KEY)
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'