Skip to content

Commit

Permalink
Merge pull request #3 from microsoft/dbanda/add_cicd
Browse files Browse the repository at this point in the history
add pipelines
  • Loading branch information
dbanda committed Jul 21, 2020
2 parents c7d63b6 + 7612a69 commit 87453a4
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions azure-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
trigger:
branches:
include:
- master

strategy:
matrix:
linux_x64_py3.6:
imageName: 'ubuntu-18.04'
python.version: '3.6'

# windows_x64_py3.6:
# imageName: 'windows-2019'
# python.version: '3.6'

# macos_x64_py3.6:
# imageName: 'macOS-10.14'
# python.version: '3.6'

# To build using more python versions follow the syntax below:
# linux_x64_py3.5:
# imageName: 'ubuntu-16.04'
# python.version: '3.5'

pool:
vmImage: '$(imageName)'

name: $(Date:yyyyMMdd).$(Rev:r)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
addToPath: true
architecture: 'x64'
displayName: 'Use Python $(python.version)'

- bash: |
python -m venv .venv
displayName: 'Create virtual environment'

- bash: |
if [[ '$(Agent.OS)' == Windows* ]]
then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
pip install --upgrade pip
pip install setuptools wheel
pip install -r requirements.txt
pip install pytest==5.3.5 pytest-cov==2.8.1
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Install dependencies'

- bash: |
if [[ '$(Agent.OS)' == Windows* ]]
then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
python -m pytest tests --cov=genalog --doctest-modules --junitxml=junit/test-results.xml --cov-report=xml --cov-report=html
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: 'Running unit tests'


- task: PublishTestResults@2
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: 'junit/*.xml'
searchFolder: $(Build.SourcesDirectory)
testRunTitle: $(imageName) Build
buildPlatform: $(imageName)
displayName: 'Publish unit test report'

- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: $(Build.SourcesDirectory)/coverage.xml
reportDirectory: $(Build.SourcesDirectory)/htmlcov
displayName: 'Publish test coverage'

- bash: |
if [[ '$(Agent.OS)' == Windows* ]]
then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
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 comments on commit 87453a4

Please sign in to comment.