Skip to content

Azure pipelines YAML pipeline #643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions ci-pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
variables:
# Container registry service connection established during pipeline creation
CI_PULL_REQUEST: $(System.PullRequest.PullRequestId)
COVERALLS_FLAG_NAME: Build \# $(Build.BuildNumber)
COVERALLS_GIT_BRANCH: $(Build.SourceBranchName)
COVERALLS_GIT_COMMIT: $(Build.SourceVersion)
COVERALLS_SERVICE_JOB_ID: $(Build.BuildId)
COVERALLS_SERVICE_NAME: python-ci
python.version: 3.7.6


jobs:
# Build and publish container
- job: Build
#Multi-configuration and multi-agent job options are not exported to YAML. Configure these options using documentation guidance: https://docs.microsoft.com/vsts/pipelines/process/phases
pool:
name: Hosted Ubuntu 1604
#Your build pipeline references the ‘python.version’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971
#Your build pipeline references the ‘python.version’ variable, which you’ve selected to be settable at queue time. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it settable at queue time. See https://go.microsoft.com/fwlink/?linkid=865971

steps:
- powershell: |
Get-ChildItem env:* | sort-object name | Format-Table -Autosize -Wrap | Out-String -Width 120
displayName: 'Get environment vars'

- task: UsePythonVersion@0
displayName: 'Use Python $(python.version)'
inputs:
versionSpec: '$(python.version)'

- script: 'sudo ln -s /opt/hostedtoolcache/Python/3.6.9/x64/lib/libpython3.6m.so.1.0 /usr/lib/libpython3.6m.so'
displayName: libpython3.6m

- script: |
python -m pip install --upgrade pip
pip install -e ./libraries/botbuilder-schema
pip install -e ./libraries/botframework-connector
pip install -e ./libraries/botbuilder-core
pip install -e ./libraries/botbuilder-ai
pip install -e ./libraries/botbuilder-applicationinsights
pip install -e ./libraries/botbuilder-dialogs
pip install -e ./libraries/botbuilder-azure
pip install -e ./libraries/botbuilder-testing
pip install -r ./libraries/botframework-connector/tests/requirements.txt
pip install -r ./libraries/botbuilder-core/tests/requirements.txt
pip install coveralls
pip install pylint
pip install black
displayName: 'Install dependencies'

- script: 'pip install requests_mock'
displayName: 'Install requests mock (REMOVE AFTER MERGING INSPECTION)'
enabled: false

- script: |
pip install pytest
pip install pytest-cov
pip install coveralls
pytest --junitxml=junit/test-results.xml --cov-config=.coveragerc --cov --cov-report=xml --cov-report=html
displayName: Pytest

- script: 'black --check libraries'
displayName: 'Check Black compliant'

- script: 'pylint --rcfile=.pylintrc libraries'
displayName: Pylint

- task: PublishTestResults@2
displayName: 'Publish Test Results **/test-results.xml'
inputs:
testResultsFiles: '**/test-results.xml'
testRunTitle: 'Python $(python.version)'

- script: 'COVERALLS_REPO_TOKEN=$(COVERALLS_TOKEN) coveralls'
displayName: 'Push test results to coveralls https://coveralls.io/github/microsoft/botbuilder-python'
continueOnError: true

- powershell: |
Set-Location ..
Get-ChildItem -Recurse -Force

displayName: 'Dir workspace'
condition: succeededOrFailed()

- powershell: |
# This task copies the code coverage file created by dotnet test into a well known location. In all
# checks I've done, dotnet test ALWAYS outputs the coverage file to the temp directory.
# My attempts to override this and have it go directly to the CodeCoverage directory have
# all failed, so I'm just doing the copy here. (cmullins)

Get-ChildItem -Path "$(Build.SourcesDirectory)" -Include "*coverage*" | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)/CodeCoverage"
displayName: 'Copy .coverage Files to CodeCoverage folder'
continueOnError: true