Skip to content

Commit ea49c03

Browse files
authored
[3.6] Clean up Travis config (GH-5727)
(cherry picked from commit 7eb3f82)
1 parent 65a13c1 commit ea49c03

File tree

1 file changed

+44
-41
lines changed

1 file changed

+44
-41
lines changed

.travis.yml

+44-41
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ group: beta
55

66
# To cache doc-building dependencies and C compiler output.
77
cache:
8-
- pip
9-
- ccache
8+
- pip
9+
- ccache
1010

1111
branches:
1212
only:
1313
- master
1414
- /^\d\.\d$/
15+
- buildbot-custom
1516

1617
matrix:
1718
fast_finish: true
@@ -41,19 +42,12 @@ matrix:
4142
compiler: gcc
4243
env: OPTIONAL=true
4344
before_script:
44-
- |
45-
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
46-
then
47-
echo "Only docs were updated, stopping build process."
48-
exit
49-
fi
50-
# Build in release mode
51-
./configure PYTHON_FOR_REGEN=python3
52-
make -s -j4
53-
# Need a venv that can parse covered code.
54-
./python -m venv venv
55-
./venv/bin/python -m pip install -U coverage
56-
./venv/bin/python -m test.pythoninfo
45+
- ./configure PYTHON_FOR_REGEN=python3
46+
- make -s -j4
47+
# Need a venv that can parse covered code.
48+
- ./python -m venv venv
49+
- ./venv/bin/python -m pip install -U coverage
50+
- ./venv/bin/python -m test.pythoninfo
5751
script:
5852
# Skip tests that re-run the entire test suite.
5953
- ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn
@@ -62,48 +56,57 @@ matrix:
6256
- source ./venv/bin/activate
6357
- bash <(curl -s https://codecov.io/bash)
6458

65-
# Travis provides only 2 cores, so don't overdo the parallelism and waste memory.
66-
before_script:
67-
- |
68-
set -e
69-
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
70-
files_changed=$(git diff --name-only $TRAVIS_COMMIT_RANGE)
71-
else
72-
# Pull requests are slightly complicated because merging the PR commit without
73-
# rebasing causes it to retain its old commit date. Meaning in history if any
74-
# commits have been made on master that post-date it, they will be accidentally
75-
# included in the diff if we use the TRAVIS_COMMIT_RANGE variable.
76-
files_changed=$(git diff --name-only HEAD $(git merge-base HEAD $TRAVIS_BRANCH))
77-
fi
78-
79-
# Prints changed files in this commit to help debug doc-only build issues.
80-
echo "Files changed: "
81-
echo $files_changed
8259

83-
if ! echo "$files_changed" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
60+
before_install:
61+
- set -e
62+
- |
63+
# Check short-circuit conditions
64+
if [ "${TESTING}" != "docs" ]
8465
then
85-
echo "Only docs were updated, stopping build process."
86-
exit
66+
if [ "$TRAVIS_PULL_REQUEST" = "false" ]
67+
then
68+
echo "Not a PR, doing full build."
69+
else
70+
# Pull requests are slightly complicated because $TRAVIS_COMMIT_RANGE
71+
# may include more changes than desired if the history is convoluted.
72+
# Instead, explicitly fetch the base branch and compare against the
73+
# merge-base commit.
74+
git fetch -q origin +refs/heads/$TRAVIS_BRANCH
75+
changes=$(git diff --name-only HEAD $(git merge-base HEAD FETCH_HEAD))
76+
echo "Files changed:"
77+
echo "$changes"
78+
if ! echo "$changes" | grep -qvE '(\.rst$)|(^Doc)|(^Misc)'
79+
then
80+
echo "Only docs were updated, stopping build process."
81+
exit
82+
fi
83+
fi
8784
fi
88-
# Build in debug mode
89-
./configure --with-pydebug PYTHON_FOR_REGEN=python3
90-
make -j4 regen-all
91-
changes=`git status --porcelain`
85+
86+
# Travis provides only 2 cores, so don't overdo the parallelism and waste memory.
87+
before_script:
88+
- ./configure --with-pydebug PYTHON_FOR_REGEN=python3
89+
- make -j4 regen-all
90+
- changes=`git status --porcelain`
91+
- |
92+
# Check for changes in regenerated files
9293
if ! test -z "$changes"
9394
then
9495
echo "Generated files not up to date"
9596
echo "$changes"
9697
exit 1
9798
fi
98-
make -j4
99-
make pythoninfo
99+
- make -j4
100+
- make pythoninfo
100101

101102
script:
102103
# Using the built Python as patchcheck.py is built around the idea of using
103104
# a checkout-build of CPython to know things like what base branch the changes
104105
# should be compared against.
105106
# Only run on Linux as the check only needs to be run once.
106107
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
108+
# Check that all symbols exported by libpython start with "Py" or "_Py"
109+
- make smelly
107110
# `-r -w` implicitly provided through `make buildbottest`.
108111
- make buildbottest TESTOPTS="-j4 -uall,-cpu"
109112

0 commit comments

Comments
 (0)