Skip to content

Commit

Permalink
Tighten travis matrix and python activation.
Browse files Browse the repository at this point in the history
A few improvements and fixes to the travis setup:
+ Upgrade to to python 2.7.14 via `python: "2.7"`.
+ Use `name` uniformly to name shards and kill the `SHARD` env var which
  was only used to achieve the same end.
+ Use anchors to DRY up python version and clippy shard failure
  ignoring.
+ Ensure travis `pyenv` pythons are on `PATH`. This works around
  travis-ci/travis-ci#8315 and nets us both
  python 2.7 and python 3.6 on all `language: python` shards.

This last is needed to support pantsbuild#6428 which fixes pantsbuild#6415.
  • Loading branch information
jsirois committed Sep 6, 2018
1 parent c06e831 commit 1787ef1
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 63 deletions.
108 changes: 45 additions & 63 deletions .travis.yml
Expand Up @@ -76,7 +76,7 @@ default_test_config: &default_test_config
- libssl-dev
stage: Test Pants
language: python
python: "2.7.13"
python: &python_version "2.7"
before_install:
# Remove bad openjdk6 from trusty image, so
# Pants will pick up oraclejdk6 from `packages` above.
Expand All @@ -88,27 +88,27 @@ matrix:
include:

# Build macOS engine
- os: osx
- name: "OSX Native Engine Binary Builder"
os: osx
# We request the oldest image we can (corresponding to OSX 10.11) for maximum compatibility.
# We use 10.11 as a minimum to avoid https://github.com/rust-lang/regex/issues/489.
# See: https://docs.travis-ci.com/user/reference/osx/#OS-X-Version
osx_image: xcode8
stage: Test Pants
language: generic
env:
- SHARD="OSX Native Engine Binary Builder"
- PREPARE_DEPLOY=1
script:
- ./pants --version && ./build-support/bin/release.sh -n

# Build Linux engine
- os: linux
- name: "Linux Native Engine Binary Builder"
os: linux
stage: Test Pants
language: generic
services:
- docker
env:
- SHARD="Linux Native Engine Binary Builder"
- PREPARE_DEPLOY=1
before_script:
- ulimit -c unlimited
Expand All @@ -129,7 +129,8 @@ matrix:
- build-support/bin/ci-failure.sh

# Deploy Pex
- os: linux
- name: "Deploy Pants PEX"
os: linux
language: python
stage: Deploy Pants Pex
env:
Expand All @@ -151,109 +152,96 @@ matrix:
repo: pantsbuild/pants

- <<: *default_test_config
env:
- SHARD="Self checks, lint, and JVM tests"
name: "Self checks, lint, and JVM tests"
before_install:
- sudo apt-get install -y pkg-config fuse libfuse-dev
- sudo modprobe fuse
- sudo chmod 666 /dev/fuse
- sudo chown root:$USER /etc/fuse.conf
script:
- ./build-support/bin/ci.sh -fkmrjt "${SHARD}"
- ./build-support/bin/travis-ci.sh -fkmrjt

- <<: *default_test_config
env:
- SHARD="Py2 - Unit tests for pants and pants-plugins"
name: "Py2 - Unit tests for pants and pants-plugins"
script:
- ./build-support/bin/ci.sh -lp "${SHARD}"
- ./build-support/bin/travis-ci.sh -lp

- <<: *default_test_config
env:
- SHARD="Py3 - Unit tests for pants and pants-plugins"
name: "Py3 - Unit tests for pants and pants-plugins"
script:
- ./build-support/bin/ci.sh -3lp "${SHARD}"
- ./build-support/bin/travis-ci.sh -3lp

- <<: *default_test_config
env:
- SHARD="Py2 - Python contrib tests"
name: "Py2 - Python contrib tests"
script:
- ./build-support/bin/ci.sh -n "${SHARD}"
- ./build-support/bin/travis-ci.sh -n

- <<: *default_test_config
env:
- SHARD="Py3 - Python contrib tests"
name: "Py3 - Python contrib tests"
script:
- ./build-support/bin/ci.sh -3n "${SHARD}"
- ./build-support/bin/travis-ci.sh -3n

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 1"
name: "Python integration tests for pants - shard 1"
script:
- ./build-support/bin/ci.sh -c -i 0/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 0/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 2"
name: "Python integration tests for pants - shard 2"
script:
- ./build-support/bin/ci.sh -c -i 1/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 1/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 3"
name: "Python integration tests for pants - shard 3"
script:
- ./build-support/bin/ci.sh -c -i 2/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 2/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 4"
name: "Python integration tests for pants - shard 4"
script:
- ./build-support/bin/ci.sh -c -i 3/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 3/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 5"
name: "Python integration tests for pants - shard 5"
script:
- ./build-support/bin/ci.sh -c -i 4/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 4/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 6"
name: "Python integration tests for pants - shard 6"
script:
- ./build-support/bin/ci.sh -c -i 5/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 5/7

- <<: *default_test_config
env:
- SHARD="Python integration tests for pants - shard 7"
name: "Python integration tests for pants - shard 7"
script:
- ./build-support/bin/ci.sh -c -i 6/7 "${SHARD}"
- ./build-support/bin/travis-ci.sh -c -i 6/7

# Rust on linux
- os: linux
- name: "Rust Tests Linux"
os: linux
dist: trusty
sudo: required
stage: Test Pants
language: python
python: "2.7.13"
python: *python_version
before_install:
- sudo apt-get install -y pkg-config fuse libfuse-dev
- sudo modprobe fuse
- sudo chmod 666 /dev/fuse
- sudo chown root:$USER /etc/fuse.conf
env:
- SHARD="Rust Tests Linux"
before_script:
- ulimit -c unlimited
- ulimit -n 8192
script:
- ./build-support/bin/ci.sh -be
- ./build-support/bin/travis-ci.sh -be
# Rust on macOS
- os: osx
- name: "Rust + Platform-specific Tests OSX"
os: osx
# Fuse actually works on this image. It hangs on many others.
osx_image: xcode8.3
stage: Test Pants
language: generic
env:
- SHARD="Rust + Platform-specific Tests OSX"
# Specifically avoid the OSX provided 2.7.10 under xcode8.3 since it returns a platform
# of `macosx-*-intel` where the `intel` suffix is bogus but pex has not yet been taught to
# deal with this. Can be removed when this issue is resolved:
Expand All @@ -265,39 +253,38 @@ matrix:
- ulimit -c unlimited
- ulimit -n 8192
script:
# Platform-specific tests currently need a pants pex, so we bootstrap here (no -b) and set -z to run the platform-specific tests.
- ./build-support/bin/ci.sh -ez
# Platform-specific tests currently need a pants pex, so we bootstrap here (no -b) and
# set -z to run the platform-specific tests.
- ./build-support/bin/travis-ci.sh -ez

# Rust Clippy on Linux with nightly Rust
- name: rust-clippy
- name: &clippy_shard "[ALLOWED TO BE RED] Rust Clippy on Linux with nightly Rust"
os: linux
dist: trusty
sudo: required
stage: Test Pants
language: python
python: "2.7.13"
python: *python_version
before_install:
- sudo apt-get install -y pkg-config fuse libfuse-dev
- sudo modprobe fuse
- sudo chmod 666 /dev/fuse
- sudo chown root:$USER /etc/fuse.conf
env:
- SHARD="Rust Clippy on Linux with nightly Rust"
before_script:
- ulimit -c unlimited
- ulimit -n 8192
script:
- ./build-support/bin/ci.sh -bs
- ./build-support/bin/travis-ci.sh -bs

allow_failures:
- name: rust-clippy
- name: *clippy_shard

deploy:
# See: https://docs.travis-ci.com/user/deployment/s3/
provider: s3
access_key_id: AKIAIWOKBXVU3JLY6EGQ
secret_access_key:
secure: UBVbpdYJ81OsDGKlPRBw6FlPJGlxosnFQ4A1xBbU5GwEBfv90GoKc6J0UwF+I4CDwytj/BlAks1XbW0zYX0oeIlXDnl1Vfikm1k4hfIr6VCLHKppiU69FlEs+ph0Dktz8+aUWhrvJzICZs6Gu08kTBQ5++3ulDWDeTHqjr713YM=
secure: "UBVbpdYJ81OsDGKlPRBw6FlPJGlxosnFQ4A1xBbU5GwEBfv90GoKc6J0UwF+I4CDwytj/BlAks1XbW0zYX0oeIlXDnl1Vfikm1k4hfIr6VCLHKppiU69FlEs+ph0Dktz8+aUWhrvJzICZs6Gu08kTBQ5++3ulDWDeTHqjr713YM="
bucket: binaries.pantsbuild.org
local_dir: dist/deploy
# Otherwise travis will stash dist/deploy and the deploy will fail.
Expand All @@ -309,8 +296,3 @@ deploy:
# release branches; eg `1.3.x`
all_branches: true
repo: pantsbuild/pants

# We accept the default travis-ci email author+committer notification
# for now which is enabled even with no `notifications` config.
# notifications:
# email: ...
22 changes: 22 additions & 0 deletions build-support/bin/travis-ci.sh
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -euo pipefail

cd "$(git rev-parse --show-toplevel)"

function pyenv_path {
local -r pyenv_root="$(cd "$(dirname "$(which pyenv)")/.." && pwd -P)"
pyenv versions --bare | while read v; do
echo "${pyenv_root}/versions/${v}/bin"
done
}

if which pyenv &>/dev/null; then
PYENV_PYTHONS="$(pyenv_path)"
PYENV_PATH="$(echo ${PYENV_PYTHONS} | tr ' ' ':')"

echo "Executing ./build-support/bin/ci.sh "$@" with ${PYENV_PATH} preprended to the PATH"

export PATH="${PYENV_PATH}:${PATH}"
fi
exec ./build-support/bin/ci.sh "$@"

0 comments on commit 1787ef1

Please sign in to comment.