• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1language: c
2dist: xenial
3
4# To cache doc-building dependencies and C compiler output.
5cache:
6  - pip
7  - ccache
8  - directories:
9    - $HOME/multissl
10
11env:
12  global:
13    - OPENSSL=1.1.1f
14    - OPENSSL_DIR="$HOME/multissl/openssl/${OPENSSL}"
15    - PATH="${OPENSSL_DIR}/bin:$PATH"
16    - CFLAGS="-I${OPENSSL_DIR}/include"
17    - LDFLAGS="-L${OPENSSL_DIR}/lib"
18    # Set rpath with env var instead of -Wl,-rpath linker flag
19    # OpenSSL ignores LDFLAGS when linking bin/openssl
20    - LD_RUN_PATH="${OPENSSL_DIR}/lib"
21
22branches:
23  only:
24    - master
25    - /^\d\.\d$/
26    - buildbot-custom
27
28matrix:
29  fast_finish: true
30  allow_failures:
31    - env: OPTIONAL=true
32  include:
33    - name: "CPython tests"
34      os: linux
35      language: c
36      compiler: clang
37      # gcc also works, but to keep the # of concurrent builds down, we use one C
38      # compiler here and the other to run the coverage build. Clang is preferred
39      # in this instance for its better error messages.
40      env: TESTING=cpython
41      addons:
42        apt:
43          packages:
44            - gdb
45            - xvfb
46    - name: "Documentation build"
47      os: linux
48      language: python
49      # Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs.
50      python: 3.6
51      env: TESTING=docs
52      before_script:
53        - cd Doc
54        # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures.
55        # (Updating the version is fine as long as no warnings are raised by doing so.)
56        # The theme used by the docs is stored separately, so we need to install that as well.
57        - python -m pip install sphinx==1.8.2 blurb python-docs-theme
58      script:
59        - make check suspicious html SPHINXOPTS="-q -W -j4"
60    - name: "Documentation tests"
61      os: linux
62      language: c
63      compiler: clang
64      env: TESTING=doctest
65      addons:
66        apt:
67          packages:
68            - xvfb
69      before_script:
70        - ./configure
71        - make -j4
72        - make -C Doc/ PYTHON=../python venv
73      script:
74        xvfb-run make -C Doc/ PYTHON=../python SPHINXOPTS="-q -W -j4" doctest
75    - name: "Test code coverage (Python)"
76      os: linux
77      language: c
78      compiler: gcc
79      env: OPTIONAL=true
80      addons:
81        apt:
82          packages:
83            - xvfb
84      before_script:
85        - |
86            if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]
87            then
88              echo "Don't run Python coverage on pull requests."
89              exit
90            fi
91        - ./configure
92        - make -j4
93        # Need a venv that can parse covered code.
94        - ./python -m venv venv
95        - ./venv/bin/python -m pip install -U coverage
96        - ./venv/bin/python -m test.pythoninfo
97      script:
98        # Skip tests that re-run the entire test suite.
99        - xvfb-run ./venv/bin/python -m coverage run --branch --pylib -m test --fail-env-changed -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn -x test_concurrent_futures || true
100      after_script:  # Probably should be after_success once test suite updated to run under coverage.py.
101        # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
102        - source ./venv/bin/activate
103        - bash <(curl -s https://codecov.io/bash)
104    - name: "Test code coverage (C)"
105      os: linux
106      language: c
107      compiler: gcc
108      env: OPTIONAL=true
109      addons:
110        apt:
111          packages:
112            - lcov
113            - xvfb
114      before_script:
115        - |
116            if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]
117            then
118              echo "Don't run C coverage on pull requests."
119              exit
120            fi
121        - ./configure
122      script:
123        - xvfb-run make -j4 coverage-report
124      after_script:  # Probably should be after_success once test suite updated to run under coverage.py.
125        - make pythoninfo
126        - bash <(curl -s https://codecov.io/bash)
127
128
129before_install:
130  - set -e
131  - |
132      # Check short-circuit conditions
133      if [[ "${TESTING}" != "docs" && "${TESTING}" != "doctest" ]]
134      then
135        if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]
136        then
137          echo "Not a PR, doing full build."
138        else
139          # Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
140          # may include more changes than desired if the history is convoluted.
141          # Instead, explicitly fetch the base branch and compare against the
142          # merge-base commit.
143          git fetch -q origin +refs/heads/$TRAVIS_BRANCH
144          changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
145          echo "Files changed:"
146          echo "$changes"
147          if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
148          then
149            echo "Only docs were updated, stopping build process."
150            exit
151          fi
152        fi
153      fi
154
155install:
156  - |
157      # Install OpenSSL as necessary
158      # Note: doctest needs OpenSSL
159      if [[ "${TESTING}" != "docs" ]]
160      then
161        # clang complains about unused-parameter a lot, redirect stderr
162        python3 Tools/ssl/multissltests.py --steps=library \
163            --base-directory ${HOME}/multissl \
164            --openssl ${OPENSSL} >/dev/null 2>&1
165      fi
166  - openssl version
167
168# Travis provides only 2 cores, so don't overdo the parallelism and waste memory.
169before_script:
170  # -Og is much faster than -O0
171  - CFLAGS="${CFLAGS} -Og" ./configure --with-pydebug
172  - make -j4 regen-all
173  - changes=`git status --porcelain`
174  - |
175      # Check for changes in regenerated files
176      if ! test -z "$changes"
177      then
178        echo "Generated files not up to date"
179        echo "$changes"
180        exit 1
181      fi
182  - make -j4
183  - make pythoninfo
184
185script:
186  # Using the built Python as patchcheck.py is built around the idea of using
187  # a checkout-build of CPython to know things like what base branch the changes
188  # should be compared against.
189  # Only run on Linux as the check only needs to be run once.
190  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
191  # Check that all symbols exported by libpython start with "Py" or "_Py"
192  - make smelly
193  # `-r -w` implicitly provided through `make buildbottest`.
194  - |
195    if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
196      XVFB_RUN=xvfb-run;
197    fi
198    $XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu"
199notifications:
200  email: false
201  irc:
202    channels:
203      # This is set to a secure variable to prevent forks from notifying the
204      # IRC channel whenever they fail a build. This can be removed when travis
205      # implements https://github.com/travis-ci/travis-ci/issues/1094.
206      # The actual value here is: irc.freenode.net#python-dev
207      - secure: "s7kAkpcom2yUJ8XqyjFI0obJmhAGrn1xmoivdaPdgBIA++X47TBp1x4pgDsbEsoalef7bEwa4l07KdT4qa+DOd/c4QxaWom7fbN3BuLVsZuVfODnl79+gYq/TAbGfyH+yDs18DXrUfPgwD7C5aW32ugsqAOd4iWzfGJQ5OrOZzqzGjYdYQUEkJFXgxDEIb4aHvxNDWGO3Po9uKISrhb5saQ0l776yLo1Ur7M4oxl8RTbCdgX0vf5TzPg52BgvZpOgt3DHOUYPeiJLKNjAE6ibg0U95sEvMfHX77nz4aFY4/3UI6FFaRla34rZ+mYKrn0TdxOhera1QOgPmM6HzdO4K44FpfK1DS0Xxk9U9/uApq+cG0bU3W+cVUHDBe5+90lpRBAXHeHCgT7TI8gec614aiT8lEr3+yH8OBRYGzkjNK8E2LJZ/SxnVxDe7aLF6AWcoWLfS6/ziAIBFQ5Nc4U72CT8fGVSkl8ywPiRlvixKdvTODMSZo0jMqlfZSNaAPTsNRx4wu5Uis4qekwe32Fz4aB6KGpsuuVjBi+H6v0RKxNJNGY3JKDiEH2TK0UE2auJ5GvLW48aUVFcQMB7euCWYXlSWVRHh3WLU8QXF29Dw4JduRZqUpOdRgMHU79UHRq+mkE0jAS/nBcS6CvsmxCpTSrfVYuMOu32yt18QQoTyU="
208    on_success: change
209    on_failure: always
210    skip_join: true
211  webhooks:
212    urls:
213      # For the same reasons as above for IRC, we encrypt the webhook address
214      # for Zulip.  The actual value is:
215      # https://python.zulipchat.com/api/v1/external/travis?api_key=<api-key-redacted>&stream=core%2Ftest+runs
216      - secure: "vLz2TodSL7wQ8DsIu86koRS9i4dsK40PH8+wzY93PBCCAzJAz113LTxK3/9PamMv+ObDRUSe5OpXcquE3d5Gwpu8IymF113qK0I3uNr+O3FtmKlj/Kd1P/V+z4pTpS3zh3lW9gyKV9EMWXIWS0IYKKZQU144XqUlIiucWK2jHJF/cSz2cRAx/6Kx68X4mZwEC7hiMOF4ZsWUMbCglM89ybeS0pr0kK9mmh88qsPyRQov3mRKswmVPlePk7clVLNAL43qSe3SzmrmACZfQ9KJYmpYnr/cjo2b6svYHcQBAwAUarZZ9KBMXeV7HwGWsSXAvHH2ynR0P++braBHGEMTGMSitdVWzFTmeiHnrkp08WAB+uFs54iEx3VklTk9bCzozTm2S94TRxbrsG9SypMvQxG570JV6P2XYuR+taCb/GMtMqrtGQm2e1Ht+nDLtiUb+/+rwEbicJJ13knptOQZI4tPOZESI/kXkORkSNwFfLSNLSl9jTlMmO7KjAAPApURHEdx26RbItAn8mIX2NcHTRjKn2qV4h3C54nmHmKWn/ZudHHJc6ieZSEUBoaLGAYmcWJRqrM6jiy2h9I9TRrCKAiGh5jT47FYKLwosTtV245l/ZhDb6eTVfEFT6TSLEoyfx9cCtTUvfMtXYl8eN9wlFYYpH8MSWbMD14eEkKBTWg="
217    on_success: change
218    on_failure: always
219