1parameters:
2  coverage: false
3  sudo_dependencies: sudo
4  dependencies: apt
5  patchcheck: true
6  xvfb: true
7
8steps:
9- checkout: self
10  clean: true
11  fetchDepth: 5
12
13# Work around a known issue affecting Ubuntu VMs on Pipelines
14- script: sudo setfacl -Rb /home/vsts
15  displayName: 'Workaround ACL issue'
16
17- script: ${{ parameters.sudo_dependencies }} ./.azure-pipelines/posix-deps-${{ parameters.dependencies }}.sh $(openssl_version)
18  displayName: 'Install dependencies'
19
20- script: ./configure --with-pydebug
21  displayName: 'Configure CPython (debug)'
22
23- script: make -j4
24  displayName: 'Build CPython'
25
26- ${{ if eq(parameters.coverage, 'true') }}:
27  - script: ./python -m venv venv && ./venv/bin/python -m pip install -U coverage
28    displayName: 'Set up virtual environment'
29
30  - script: ./venv/bin/python -m test.pythoninfo
31    displayName: 'Display build info'
32
33  - script: |
34      $COMMAND -m coverage run --pylib -m test \
35                --fail-env-changed \
36                -uall,-cpu \
37                --junit-xml=$(build.binariesDirectory)/test-results.xml \
38                -x test_multiprocessing_fork \
39                -x test_multiprocessing_forkserver \
40                -x test_multiprocessing_spawn \
41                -x test_concurrent_futures
42    displayName: 'Tests with coverage'
43    env:
44      ${{ if eq(parameters.xvfb, 'true') }}:
45        COMMAND: xvfb-run ./venv/bin/python
46      ${{ if ne(parameters.xvfb, 'true') }}:
47        COMMAND: ./venv/bin/python
48
49  - script: ./venv/bin/python -m coverage xml
50    displayName: 'Generate coverage.xml'
51
52  - script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
53    displayName: 'Publish code coverage results'
54
55
56- ${{ if ne(parameters.coverage, 'true') }}:
57  - script: make pythoninfo
58    displayName: 'Display build info'
59
60  - script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml"
61    displayName: 'Tests'
62    env:
63      ${{ if eq(parameters.xvfb, 'true') }}:
64        COMMAND: xvfb-run make
65      ${{ if ne(parameters.xvfb, 'true') }}:
66        COMMAND: make
67
68- ${{ if eq(parameters.patchcheck, 'true') }}:
69  - script: |
70      git fetch origin
71      ./python Tools/scripts/patchcheck.py --ci true
72    displayName: 'Run patchcheck.py'
73    condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
74
75
76- task: PublishTestResults@2
77  displayName: 'Publish Test Results'
78  inputs:
79    testResultsFiles: '$(build.binariesDirectory)/test-results.xml'
80    mergeTestResults: true
81    testRunTitle: $(testRunTitle)
82    platform: $(testRunPlatform)
83  condition: succeededOrFailed()
84