Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Another attempt at running Python 3.7 on Travis #1369

Closed
wants to merge 16 commits into from
Closed
19 changes: 13 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
version: 2
jobs:
build:
test_linux:
steps:
- checkout
- restore_cache:
keys:
- v1-runtimes-
- run: ./build.sh check-py37
- save_cache:
key: v1-runtimes-{{ epoch }}
paths:
- ~/.cache/hypothesis-build-runtimes
test_osx:
macos:
xcode: 9.3.0
steps:
Expand All @@ -10,11 +21,7 @@ jobs:
- restore_cache:
keys:
- v1-runtimes-
- run: ./build.sh install-core
- run: ./build.sh check-coverage
- run: ./build.sh check-pure-tracer
- run: ./build.sh check-py27
- run: ./build.sh check-py36
- run: ./build.sh check-py37
- save_cache:
key: v1-runtimes-{{ epoch }}
paths:
Expand Down
40 changes: 2 additions & 38 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: c

dist: xenial
sudo: false

env: PYTHONDONTWRITEBYTECODE=x
Expand Down Expand Up @@ -34,44 +35,7 @@ jobs:
include:
# Prechecks that we want to run first.
- stage: precheck
env: TASK=check-whole-repo-tests
- env: TASK=documentation
- env: TASK=lint
- env: TASK=lint-ruby
- env: TASK=doctest
- env: TASK=check-format
- env: TASK=check-requirements
- env: TASK=check-rust-tests

- stage: main
env: TASK=check-pypy
- env: TASK=check-py27
- env: TASK=check-py36
- env: TASK=check-quality
- env: TASK=check-ruby-tests

# Less important tests that will probably
# pass whenever the above do but are still
# worth testing.
- stage: extras
env: TASK=check-unicode
- env: TASK=check-py27-typing
- env: TASK=check-py34
- env: TASK=check-py35
- env: TASK=check-nose
- env: TASK=check-pytest28
- env: TASK=check-faker070
- env: TASK=check-faker-latest
- env: TASK=check-django20
- env: TASK=check-django111
- env: TASK=check-pandas19
- env: TASK=check-pandas20
- env: TASK=check-pandas21
- env: TASK=check-pandas22
- env: TASK=check-pandas23

- stage: deploy
env: TASK=deploy
env: TASK=check-py37

script:
- ./build.sh
Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/scripts/basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if [ "$DARWIN" = true ]; then
exit 0
fi

if [ "$(python -c 'import sys; print(sys.version_info[:2] in ((2, 7), (3, 6)))')" = "False" ] ; then
if [ "$(python -c 'import sys; print(sys.version_info[:2] in ((2, 7), (3, 7)))')" = "False" ] ; then
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion hypothesis-python/tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{27,34,35,36,py27}-{brief,prettyquick,full,custom}
envlist = py{27,34,35,36,37,py27}-{brief,prettyquick,full,custom}
toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
Expand Down
9 changes: 9 additions & 0 deletions tooling/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export ROOT
export BUILD_RUNTIMES=${BUILD_RUNTIMES:-$HOME/.cache/hypothesis-build-runtimes}
export BASE="$BUILD_RUNTIMES"
export PYENV="$BASE/pyenv"
export OPENSSL_DIR="$BASE/openssl"
export SNAKEPIT="$BASE/python-versions/"
export VIRTUALENVS="$BASE/virtualenvs/"
export RBENV_VERSION="2.5.1"
Expand All @@ -24,6 +25,14 @@ export GEM_PATH="$GEM_HOME"

export PATH="$INSTALLED_RUBY_DIR/bin:$HOME/.cargo/bin:$PATH"

if [[ "$(uname -s)" == 'Darwin' ]]; then
DARWIN=true
else
DARWIN=false
fi

export DARWIN

pythonloc() {
VERSION="$1"
echo "$SNAKEPIT/$VERSION"
Expand Down
33 changes: 26 additions & 7 deletions tooling/scripts/ensure-python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,31 @@ if [ ! -e "$TARGET/bin/python" ] ; then
done
trap 'rm -rf $LOCKFILE' EXIT

# shellcheck disable=SC2072
if [[ ! "$VERSION" < "3.7" ]] ; then
if [ ! -e "$OPENSSL_DIR/lib/libssl.a" ] ; then
rm -rf "$OPENSSL_DIR"
OPENSSL_BUILD_DIR="$BASE/openssl-builddir"
pushd "$BASE"
rm -rf "$OPENSSL_BUILD_DIR"
mkdir -p "$OPENSSL_BUILD_DIR"
cd "$OPENSSL_BUILD_DIR"
curl -O https://www.openssl.org/source/openssl-1.0.2o.tar.gz
tar -xf openssl-1.0.2o.tar.gz
cd openssl-1.0.2o
if [ "$DARWIN" = "true" ] ; then
./Configure darwin64-x86_64-cc --openssldir="$OPENSSL_DIR"
else
./config --openssldir="$OPENSSL_DIR" --shared
fi
make install
popd
fi

export CFLAGS="-I$OPENSSL_DIR/include"
export LDFLAGS="-L$OPENSSL_DIR/lib -lssl -lcrypto"
export CONFIGURE_OPTS="--with-openssl=$OPENSSL_DIR"
fi

if [ ! -d "$PYENV/.git" ]; then
rm -rf "$PYENV"
Expand All @@ -56,11 +81,5 @@ if [ ! -e "$TARGET/bin/python" ] ; then
cd "$back"
fi

for _ in $(seq 5); do
if "$BASE/pyenv/plugins/python-build/bin/python-build" "$VERSION" "$TARGET" ; then
exit 0
fi
echo "Command failed. Retrying..."
sleep $(( ( RANDOM % 10 ) + 1 )).$(( RANDOM % 100 ))s
done
"$BASE/pyenv/plugins/python-build/bin/python-build" --verbose "$VERSION" "$TARGET"
fi
8 changes: 7 additions & 1 deletion tooling/src/hypothesistooling/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ def run_tox(task, version):
PY34 = '3.4.8'
PY35 = '3.5.5'
PY36 = '3.6.5'
PY37 = '3.7.0'
PYPY2 = 'pypy2.7-5.10.0'


Expand All @@ -347,7 +348,7 @@ def install_core():
PYPY2: 'pypy',
}

for n in [PY27, PY34, PY35, PY36]:
for n in [PY27, PY34, PY35, PY36, PY37]:
major, minor, patch = n.split('.')
ALIASES[n] = 'python%s.%s' % (major, minor)

Expand Down Expand Up @@ -375,6 +376,11 @@ def check_py36():
run_tox('py36-full', PY36)


@python_tests
def check_py37():
run_tox('py37-full', PY37)


@python_tests
def check_pypy():
run_tox('pypy-full', PYPY2)
Expand Down