Skip to content

Travis CI - Stages, Cleanup and magic #5450

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

Merged
merged 3 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 41 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,62 @@ sudo: false
cache: pip
dist: trusty

matrix:
fast_finish: true
stages:
- primary
- secondary

jobs:
include:
- env: TOXENV=docs
# Basic Checks
- stage: primary
env: TOXENV=docs
- env: TOXENV=lint-py2
- env: TOXENV=lint-py3
python: 3.6
- env: TOXENV=mypy
- env: TOXENV=packaging
# PyPy jobs start first -- they are the slowest
- env: TOXENV=pypy3-functional-install
python: pypy3
- env: TOXENV=pypy3-others
python: pypy3
- env: TOXENV=pypy-functional-install
python: pypy
- env: TOXENV=pypy-others
python: pypy
# Latest Stable CPython jobs
- env: TOXENV=py27-functional-install
# Latest CPython
- env: GROUP=1
python: 2.7
- env: TOXENV=py27-others
- env: GROUP=2
python: 2.7
- env: TOXENV=py36-functional-install
- env: GROUP=1
python: 3.6
- env: TOXENV=py36-others
- env: GROUP=2
python: 3.6
# All the other Py3 versions
- env: TOXENV=py35-functional-install

# Complete checking for ensuring compatibility
# PyPy
- stage: secondary
env: GROUP=1
python: pypy3
- env: GROUP=2
python: pypy3
- env: GROUP=1
python: pypy
- env: GROUP=2
python: pypy
# Older Supported CPython
- env: GROUP=1
python: 3.5
- env: TOXENV=py35-others
- env: GROUP=2
python: 3.5
- env: TOXENV=py34-functional-install
- env: GROUP=1
python: 3.4
- env: TOXENV=py34-others
- env: GROUP=2
python: 3.4
# Nightly Python goes last
- env: TOXENV=py37-functional-install
python: nightly
- env: TOXENV=py37-others
python: nightly

- env: GROUP=1
python: 3.7-dev
- env: GROUP=2
python: 3.7-dev

# It's okay to fail on the in-development CPython version.
fast_finish: true
allow_failures:
- python: nightly
- python: 3.7-dev

before_install: .travis/setup.sh
install: travis_retry .travis/install.sh
script: .travis/run.sh

Expand Down
3 changes: 0 additions & 3 deletions .travis/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
set -e
set -x

git config --global user.email "[email protected]"
git config --global user.name "pip"

pip install --upgrade setuptools
pip install --upgrade tox
32 changes: 23 additions & 9 deletions .travis/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
set -e
set -x

# Short circuit tests and linting jobs if there are no code changes involved.
if [[ $TOXENV != docs ]]; then
Expand All @@ -24,16 +23,31 @@ if [[ $TOXENV != docs ]]; then
fi
fi

if [[ $TOXENV == py*-functional-install ]]; then
# Only run test_install*.py integration tests
tox -- -m integration -n 4 --duration=5 -k test_install
elif [[ $TOXENV == py* ]]; then
# Run unit tests
tox -- -m unit
# Export the correct TOXENV when not provided.
echo "Determining correct TOXENV..."
if [[ -z "$TOXENV" ]]; then
if [[ ${TRAVIS_PYTHON_VERSION} == pypy* ]]; then
export TOXENV=${TRAVIS_PYTHON_VERSION}
else
# We use the syntax ${string:index:length} to make 2.7 -> py27
_major=${TRAVIS_PYTHON_VERSION:0:1}
_minor=${TRAVIS_PYTHON_VERSION:2:1}
export TOXENV="py${_major}${_minor}"
fi
fi
echo "TOXENV=${TOXENV}"

# Run other integration tests
# Print the commands run for this test.
set -x
if [[ "$GROUP" == "1" ]]; then
# Unit tests
tox -- -m unit
# Integration tests (not the ones for 'pip install')
tox -- -m integration -n 4 --duration=5 -k "not test_install"
elif [[ "$GROUP" == "2" ]]; then
# Separate Job for running integration tests for 'pip install'
tox -- -m integration -n 4 --duration=5 -k "test_install"
else
# Run once
# Non-Testing Jobs should run once
tox
fi
6 changes: 6 additions & 0 deletions .travis/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

echo "Setting Git Credentials..."
git config --global user.email "[email protected]"
git config --global user.name "pip"
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
envlist =
docs, packaging, lint-py2, lint-py3, mypy,
py{27,34,35,36,37,py,py3}-{functional-install,others}
py27, py34, py35, py67, py37, pypy, pypy3

[testenv]
passenv = CI GIT_SSL_CAINFO
Expand Down