|
| 1 | +parameters: |
| 2 | + coverage: false |
| 3 | + sudo_dependencies: sudo |
| 4 | + dependencies: apt |
| 5 | + patchcheck: true |
| 6 | + xvfb: true |
| 7 | + |
| 8 | +steps: |
| 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 -s -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) |
| 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: ./python Tools/scripts/patchcheck.py --travis true |
| 70 | + displayName: 'Run patchcheck.py' |
| 71 | + condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest')) |
| 72 | + |
| 73 | + |
| 74 | +- task: PublishTestResults@2 |
| 75 | + displayName: 'Publish Test Results' |
| 76 | + inputs: |
| 77 | + testResultsFiles: '$(build.binariesDirectory)/test-results.xml' |
| 78 | + mergeTestResults: true |
| 79 | + testRunTitle: $(testRunTitle) |
| 80 | + platform: $(testRunPlatform) |
| 81 | + condition: succeededOrFailed() |
0 commit comments