summaryrefslogtreecommitdiffstats
path: root/.azure-pipelines/posix-steps.yml
blob: 2a3680897302efe1b2c73a4eede3bc8925a8ea1c (plain)
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
parameters:
  coverage: false
  sudo_dependencies: sudo
  dependencies: apt
  patchcheck: true
  xvfb: true

steps:
- checkout: self
  clean: true
  fetchDepth: 5

# Work around a known issue affecting Ubuntu VMs on Pipelines
- script: sudo setfacl -Rb /home/vsts
  displayName: 'Workaround ACL issue'

- script: ${{ parameters.sudo_dependencies }} ./.azure-pipelines/posix-deps-${{ parameters.dependencies }}.sh $(openssl_version)
  displayName: 'Install dependencies'

- script: ./configure --with-pydebug
  displayName: 'Configure CPython (debug)'

- script: make -j4
  displayName: 'Build CPython'

- ${{ if eq(parameters.coverage, 'true') }}:
  - script: ./python -m venv venv && ./venv/bin/python -m pip install -U coverage
    displayName: 'Set up virtual environment'

  - script: ./venv/bin/python -m test.pythoninfo
    displayName: 'Display build info'

  - script: |
      $COMMAND -m coverage run --pylib -m test \
                --fail-env-changed \
                -uall,-cpu \
                --junit-xml=$(build.binariesDirectory)/test-results.xml \
                -x test_multiprocessing_fork \
                -x test_multiprocessing_forkserver \
                -x test_multiprocessing_spawn \
                -x test_concurrent_futures
    displayName: 'Tests with coverage'
    env:
      ${{ if eq(parameters.xvfb, 'true') }}:
        COMMAND: xvfb-run ./venv/bin/python
      ${{ if ne(parameters.xvfb, 'true') }}:
        COMMAND: ./venv/bin/python

  - script: ./venv/bin/python -m coverage xml
    displayName: 'Generate coverage.xml'

  - script: source ./venv/bin/activate && bash <(curl -s https://codecov.io/bash) -y .github/codecov.yml
    displayName: 'Publish code coverage results'


- ${{ if ne(parameters.coverage, 'true') }}:
  - script: make pythoninfo
    displayName: 'Display build info'

  - script: $COMMAND buildbottest TESTOPTS="-j4 -uall,-cpu --junit-xml=$(build.binariesDirectory)/test-results.xml"
    displayName: 'Tests'
    env:
      ${{ if eq(parameters.xvfb, 'true') }}:
        COMMAND: xvfb-run make
      ${{ if ne(parameters.xvfb, 'true') }}:
        COMMAND: make

- ${{ if eq(parameters.patchcheck, 'true') }}:
  - script: ./python Tools/scripts/patchcheck.py --ci true
    displayName: 'Run patchcheck.py'
    condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))


- task: PublishTestResults@2
  displayName: 'Publish Test Results'
  inputs:
    testResultsFiles: '$(build.binariesDirectory)/test-results.xml'
    mergeTestResults: true
    testRunTitle: $(testRunTitle)
    platform: $(testRunPlatform)
  condition: succeededOrFailed()