|
| 1 | +variables: |
| 2 | + # Container registry service connection established during pipeline creation |
| 3 | + CI_PULL_REQUEST: $(System.PullRequest.PullRequestId) |
| 4 | + COVERALLS_FLAG_NAME: Build \# $(Build.BuildNumber) |
| 5 | + COVERALLS_GIT_BRANCH: $(Build.SourceBranchName) |
| 6 | + COVERALLS_GIT_COMMIT: $(Build.SourceVersion) |
| 7 | + COVERALLS_SERVICE_JOB_ID: $(Build.BuildId) |
| 8 | + COVERALLS_SERVICE_NAME: python-ci |
| 9 | + python.version: 3.7.6 |
| 10 | + |
| 11 | + |
| 12 | +jobs: |
| 13 | +# Build and publish container |
| 14 | +- job: Build |
| 15 | +#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 |
| 16 | + pool: |
| 17 | + name: Hosted Ubuntu 1604 |
| 18 | + #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 |
| 19 | + #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 |
| 20 | + |
| 21 | + steps: |
| 22 | + - powershell: | |
| 23 | + Get-ChildItem env:* | sort-object name | Format-Table -Autosize -Wrap | Out-String -Width 120 |
| 24 | + displayName: 'Get environment vars' |
| 25 | +
|
| 26 | + - task: UsePythonVersion@0 |
| 27 | + displayName: 'Use Python $(python.version)' |
| 28 | + inputs: |
| 29 | + versionSpec: '$(python.version)' |
| 30 | + |
| 31 | + - script: 'sudo ln -s /opt/hostedtoolcache/Python/3.6.9/x64/lib/libpython3.6m.so.1.0 /usr/lib/libpython3.6m.so' |
| 32 | + displayName: libpython3.6m |
| 33 | + |
| 34 | + - script: | |
| 35 | + python -m pip install --upgrade pip |
| 36 | + pip install -e ./libraries/botbuilder-schema |
| 37 | + pip install -e ./libraries/botframework-connector |
| 38 | + pip install -e ./libraries/botbuilder-core |
| 39 | + pip install -e ./libraries/botbuilder-ai |
| 40 | + pip install -e ./libraries/botbuilder-applicationinsights |
| 41 | + pip install -e ./libraries/botbuilder-dialogs |
| 42 | + pip install -e ./libraries/botbuilder-azure |
| 43 | + pip install -e ./libraries/botbuilder-testing |
| 44 | + pip install -r ./libraries/botframework-connector/tests/requirements.txt |
| 45 | + pip install -r ./libraries/botbuilder-core/tests/requirements.txt |
| 46 | + pip install coveralls |
| 47 | + pip install pylint |
| 48 | + pip install black |
| 49 | + displayName: 'Install dependencies' |
| 50 | +
|
| 51 | + - script: 'pip install requests_mock' |
| 52 | + displayName: 'Install requests mock (REMOVE AFTER MERGING INSPECTION)' |
| 53 | + enabled: false |
| 54 | + |
| 55 | + - script: | |
| 56 | + pip install pytest |
| 57 | + pip install pytest-cov |
| 58 | + pip install coveralls |
| 59 | + pytest --junitxml=junit/test-results.xml --cov-config=.coveragerc --cov --cov-report=xml --cov-report=html |
| 60 | + displayName: Pytest |
| 61 | +
|
| 62 | + - script: 'black --check libraries' |
| 63 | + displayName: 'Check Black compliant' |
| 64 | + |
| 65 | + - script: 'pylint --rcfile=.pylintrc libraries' |
| 66 | + displayName: Pylint |
| 67 | + |
| 68 | + - task: PublishTestResults@2 |
| 69 | + displayName: 'Publish Test Results **/test-results.xml' |
| 70 | + inputs: |
| 71 | + testResultsFiles: '**/test-results.xml' |
| 72 | + testRunTitle: 'Python $(python.version)' |
| 73 | + |
| 74 | + - script: 'COVERALLS_REPO_TOKEN=$(COVERALLS_TOKEN) coveralls' |
| 75 | + displayName: 'Push test results to coveralls https://coveralls.io/github/microsoft/botbuilder-python' |
| 76 | + continueOnError: true |
| 77 | + |
| 78 | + - powershell: | |
| 79 | + Set-Location .. |
| 80 | + Get-ChildItem -Recurse -Force |
| 81 | + |
| 82 | + displayName: 'Dir workspace' |
| 83 | + condition: succeededOrFailed() |
| 84 | +
|
| 85 | + - powershell: | |
| 86 | + # This task copies the code coverage file created by dotnet test into a well known location. In all |
| 87 | + # checks I've done, dotnet test ALWAYS outputs the coverage file to the temp directory. |
| 88 | + # My attempts to override this and have it go directly to the CodeCoverage directory have |
| 89 | + # all failed, so I'm just doing the copy here. (cmullins) |
| 90 | + |
| 91 | + Get-ChildItem -Path "$(Build.SourcesDirectory)" -Include "*coverage*" | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)/CodeCoverage" |
| 92 | + displayName: 'Copy .coverage Files to CodeCoverage folder' |
| 93 | + continueOnError: true |
0 commit comments