1language: c
2dist: trusty
3sudo: false
4group: beta
5
6# To cache doc-building dependencies and C compiler output.
7cache:
8  - pip
9  - ccache
10
11env:
12  global:
13    # Use -O3 because we don't use debugger on Travis-CI
14    - CFLAGS="-O3"
15
16branches:
17  only:
18    - master
19    - /^\d\.\d$/
20    - buildbot-custom
21
22matrix:
23  fast_finish: true
24  allow_failures:
25    - env: OPTIONAL=true
26  include:
27    - os: linux
28      language: c
29      compiler: clang
30      # gcc also works, but to keep the # of concurrent builds down, we use one C
31      # compiler here and the other to run the coverage build. Clang is preferred
32      # in this instance for its better error messages.
33      env: TESTING=cpython
34      addons:
35        apt:
36          packages:
37            - xvfb
38    - os: linux
39      language: python
40      python: 2.7
41      env: TESTING=docs
42      before_script:
43        - cd Doc
44        # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures.
45        # (Updating the version is fine as long as no warnings are raised by doing so.)
46        - python -m pip install sphinx~=1.6.1
47      script:
48        - make check suspicious html SPHINXOPTS="-q -W -j4"
49
50
51before_install:
52  - set -e
53  - |
54      # Check short-circuit conditions
55      if [ "${TESTING}" != "docs" ]
56      then
57        if [ "$TRAVIS_PULL_REQUEST" = "false" ]
58        then
59          echo "Not a PR, doing full build."
60        else
61          # Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
62          # may include more changes than desired if the history is convoluted.
63          # Instead, explicitly fetch the base branch and compare against the
64          # merge-base commit.
65          git fetch -q origin +refs/heads/$TRAVIS_BRANCH
66          changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
67          echo "Files changed:"
68          echo "$changes"
69          if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
70          then
71            echo "Only docs were updated, stopping build process."
72            exit
73          fi
74        fi
75      fi
76
77
78# Travis provides only 2 cores, so don't overdo the parallelism and waste memory.
79before_script:
80  - ./configure --with-pydebug
81  - make -j4 regen-all
82  - changes=`git status --porcelain`
83  - |
84      # Check for changes in regenerated files
85      if ! test -z "$changes"
86      then
87        echo "Generated files not up to date"
88        echo "$changes"
89        exit 1
90      fi
91  - make -j4
92  - make pythoninfo
93
94script:
95  # Check that all symbols exported by libpython start with "Py" or "_Py"
96  - make smelly
97  # `-r -w` implicitly provided through `make buildbottest`.
98  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then XVFB_RUN=xvfb-run; fi; $XVFB_RUN make buildbottest TESTOPTS="-j4 -uall,-cpu"
99
100notifications:
101  email: false
102  irc:
103    channels:
104      # This is set to a secure variable to prevent forks from notifying the
105      # IRC channel whenever they fail a build. This can be removed when travis
106      # implements https://github.com/travis-ci/travis-ci/issues/1094.
107      # The actual value here is: irc.freenode.net#python-dev
108      - secure: "s7kAkpcom2yUJ8XqyjFI0obJmhAGrn1xmoivdaPdgBIA++X47TBp1x4pgDsbEsoalef7bEwa4l07KdT4qa+DOd/c4QxaWom7fbN3BuLVsZuVfODnl79+gYq/TAbGfyH+yDs18DXrUfPgwD7C5aW32ugsqAOd4iWzfGJQ5OrOZzqzGjYdYQUEkJFXgxDEIb4aHvxNDWGO3Po9uKISrhb5saQ0l776yLo1Ur7M4oxl8RTbCdgX0vf5TzPg52BgvZpOgt3DHOUYPeiJLKNjAE6ibg0U95sEvMfHX77nz4aFY4/3UI6FFaRla34rZ+mYKrn0TdxOhera1QOgPmM6HzdO4K44FpfK1DS0Xxk9U9/uApq+cG0bU3W+cVUHDBe5+90lpRBAXHeHCgT7TI8gec614aiT8lEr3+yH8OBRYGzkjNK8E2LJZ/SxnVxDe7aLF6AWcoWLfS6/ziAIBFQ5Nc4U72CT8fGVSkl8ywPiRlvixKdvTODMSZo0jMqlfZSNaAPTsNRx4wu5Uis4qekwe32Fz4aB6KGpsuuVjBi+H6v0RKxNJNGY3JKDiEH2TK0UE2auJ5GvLW48aUVFcQMB7euCWYXlSWVRHh3WLU8QXF29Dw4JduRZqUpOdRgMHU79UHRq+mkE0jAS/nBcS6CvsmxCpTSrfVYuMOu32yt18QQoTyU="
109    on_success: change
110    on_failure: always
111    skip_join: true
112