summaryrefslogtreecommitdiffstats
path: root/.travis.yml
blob: 985a544a85e4d77ead70b284b31cc5a005bbd518 (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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
dist: trusty
language: python

# Used: travis encrypt "chat.freenode.net#scons" --add notifications.irc
notifications:
  irc:
    secure: TTb+41Bj1qIUc6vj+kDqBME8H3lqXdAe1RWAjjz5hL7bzFah6qCBHNJn4DwzqYs6+Pwuwp+6wFy8hgmQttJnXve4h6GtjtvlWprDqxaC7RkFqMWFDBzDalgbB54Bi4+TTZmSJ1K/duI3LrDaN873nyn+2GBnj+3TiNtgURp1fsJMpPxXJzAsoC8UthEsbx0Zkoal/WF+IfsT2q1yQRmAwB9r/drbahx/FfL16r1QjDbI9y1fKvN5J3PirLUvxtHfuH1r8zq1vlLew2fvldgVRtFv7+Lsk2waG/eiRpMf94V5JWP1rNreV/i4AUbZaTLb3bkrhtvTjSKhvx69Ydm+ygXdRgWOD/KRgqpLNAfA+t/a2J1R++89svQI4dPBpQjlfua1elcDCFddeIslgnjDUPO23Y0o7tHAy8sWkwhTcZH1Wm42uJP6Z6tHTH6+dMLvvZpkq4RUKUcrXvoUvCsVlWMGjcsBX+AEQSFGDJnLtLehO9x0QbgVga/IRKjgpDWgQDZgro3AkGg/zzVj5uFRUoU+rbmEXq9feh5i3HfExAvA3UoEtnQ6uadDyWqtQcLRFmPSWDU82CO+sanGdFL0jBjigE8ubPObzxEAz3Fg1xk56OYBkAdEd+2KEzeO1nqJmrhsnc3c/3+b1cBvaL5ozW4XB4XcWsOi268SoiBrcBo=

addons:
  apt:
    update: true

os:
  - linux

install:
  # needed for Docbook tests, must be in virtualenv context
  - pip install lxml==4.3.3
  # do the rest of the image setup
  - ./.travis/install.sh

# pypy is not passing atm, but still report build success for now
# allow coverage to fail, so we can still do testing for all platforms
matrix:
  allow_failures:
    - python: pypy3
    - stage: Coverage

# run coverage first as its still useful to collect
stages:
  - Coverage
  - Test

# Note: Travis does not provide a way to specify the order of
# jobs within a Stage, which are "run in parallel", but with
# limitations: from observation four or five are kicked
# off, then additional jobs as initial ones complete.
# We want the slowest jobs in the first batch since the
# faster ones are less than half the time of the slowest,
# we should be able to finish the Test task in the time of the
# slowest job rather than (a fast job + the slowest job).
# Putting the pypy jobs first may help with this, though it's
# apparently not guaranteed.

jobs:
  include:
    - &test_job
      stage: Test
      script: python runtest.py -a -t -j 2 || if [[ $? == 2 ]]; then true; else false; fi
      before_script: skip
      after_success: skip
      python: pypy3
      env:
        - PYVER=pypy3
        - PYTHON=pypy3
      sudo: required


    - <<: *test_job
      python: 3.5
      env:
        - PYVER=35
        - PYTHON=3.5
      sudo: required

    - <<: *test_job
      python: 3.6
      env:
        - PYVER=36
        - PYTHON=3.6
      sudo: required

    - <<: *test_job
      python: 3.7
      env:
        - PYVER=37
        - PYTHON=3.7
      sudo: required
      dist: xenial  # required for Python >= 3.7

    - <<: *test_job
      python: 3.8
      env:
        - PYVER=38
        - PYTHON=3.8
      sudo: required
      dist: bionic  # required for Python >= 3.8


    - &coverage_jobs
      stage: Coverage
      dist: bionic
      python: 3.7
      before_script:
        # install our own python so we can modify usercustomize.py
#        - deactivate
#        - sudo add-apt-repository -y ppa:deadsnakes/ppa
#        - sudo apt-get update || true
#        - sudo apt-get -y install python$PYTHON
#        - wget https://bootstrap.pypa.io/get-pip.py
#        - sudo -H python$PYTHON get-pip.py
        - which python
        - python --version
        - python -m pip install -U coverage codecov
        # set this ensure user sites are available
        - export PYTHONNOUSERSITE=
        # attempt to get a location where we can store the usercustomize.py file
        - python -m site
#        - export PYSITEDIR=$(python -m site --user-site)
        - export PYSITEDIR=$(python -c "import sys; print(sys.path[-1])")
        - mkdir -p $PYSITEDIR
        - export COVERAGE_FILE=$PWD/.coverage
        # write the usercustomize.py file so all python processes use coverage and know where the config file is
        - echo "import os" |  tee --append ${PYSITEDIR}/sitecustomize.py
        - echo "os.environ['COVERAGE_PROCESS_START'] = '$PWD/.coveragerc'" | tee --append ${PYSITEDIR}/sitecustomize.py
        - echo "import coverage" | tee --append ${PYSITEDIR}/sitecustomize.py
        - echo "coverage.process_startup()" | tee --append ${PYSITEDIR}/sitecustomize.py

      script:
        - export TOTAL_BUILD_JOBS=1
        # write the coverage config file
        - export COVERAGE_PROCESS_START=$PWD/.coveragerc
        - echo "[run]" >> .coveragerc
        - echo "source = $PWD/src" >> .coveragerc
        - echo "parallel = True" >> .coveragerc
        - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc
        - echo "[path]" >> .coveragerc
        - echo "source = $PWD" >> .coveragerc
        - echo "[report]" >> .coveragerc
        - printf "omit =\n\t*Tests.py\n\tsrc/test_*\n\tsrc/setup.py\n\n" >> .coveragerc
        # get a list of all the tests to split them up
        - python runtest.py -l -a > all_tests
        - let "start = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * (${BUILD_JOB_NUM} - 1)"; true;
        - let "end = ($(wc -l < all_tests) / ${TOTAL_BUILD_JOBS}) * ${BUILD_JOB_NUM}"
        - if (( ${BUILD_JOB_NUM} == ${TOTAL_BUILD_JOBS} )); then end=$(wc -l < all_tests); fi
        - if (( ${start} == 0 )); then start=1; fi
        - sed -n ${start},${end}p all_tests > build_tests
        - coverage run -p --rcfile=$PWD/.coveragerc runtest.py -f build_tests -j 2 || if [[ $? == 2 ]]; then true; else false; fi

      after_script:
        - coverage combine
        - coverage report
        - coverage xml -o coverage_xml.xml
        - codecov -X gcov --file coverage_xml.xml
        # not using coveralls but leaving it commented to
        # make it easy to re-enable
        #- python$PYTHON -m pip install --user -U coveralls
        #- coveralls --rcfile=$PWD/.coveragerc

      env:
        - PYVER=37
        - PYTHON=3.7
        - BUILD_JOB_NUM=1