File size: 4,637 Bytes
0827183
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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.38: 3.8
  python.39: 3.9
  python.310: 3.10
  python.311: 3.11
  # PythonCoverallsToken: get this from Azure

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:
    vmImage: 'ubuntu-latest'

  strategy:
      matrix:
        Python38:
          PYTHON_VERSION: '$(python.38)'
        Python39:
          PYTHON_VERSION: '$(python.39)'
        Python310:
          PYTHON_VERSION: '$(python.310)'
        Python311:
          PYTHON_VERSION: '$(python.311)'
      maxParallel: 3

  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: |
      python -m pip install --upgrade pip
      pip install -e ./libraries/botbuilder-schema
      pip install -e ./libraries/botframework-connector
      pip install -e ./libraries/botframework-streaming
      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 -e ./libraries/botbuilder-integration-applicationinsights-aiohttp
      pip install -e ./libraries/botbuilder-adapters-slack
      pip install -e ./libraries/botbuilder-integration-aiohttp
      pip install -r ./libraries/botframework-connector/tests/requirements.txt
      pip install -r ./libraries/botbuilder-core/tests/requirements.txt
      pip install -r ./libraries/botbuilder-ai/tests/requirements.txt
      pip install coveralls
      pip install pylint==2.17
      pip install black==24.4.2
    displayName: 'Install dependencies'

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

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

  - script: |
      pip install pytest
      pip install pytest-cov
      pip install coveralls
      pytest --junitxml=junit/test-results.$(PYTHON_VERSION).xml --cov-config=.coveragerc --cov --cov-report=xml --cov-report=html --ignore=libraries/functional-tests/tests/test_slack_client.py
    displayName: Pytest

  - task: PublishCodeCoverageResults@1
    displayName: 'Publish Test Coverage'
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
      reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'

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

  - script: 'COVERALLS_REPO_TOKEN=$(PythonCoverallsToken) coveralls'
    displayName: 'Push test results to coveralls https://coveralls.io/github/microsoft/botbuilder-python'
    continueOnError: true
    condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false'))

  - 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

  - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
    displayName: 'Component Detection'