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

Run contrib tests with unit tests and integration tests for fewer CI delays #7709

Merged
merged 8 commits into from
Jun 5, 2019
35 changes: 0 additions & 35 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1657,41 +1657,6 @@ matrix:
- <<: *linux_rust_tests
- <<: *osx_rust_tests

- <<: *py27_linux_test_config
name: "Python contrib tests (Py2.7 PEX)"
stage: *test
env:
- *py27_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py27
script:
- ./build-support/bin/ci.sh -2n

- <<: *py36_linux_test_config
name: "Python contrib tests (Py3.6 PEX)"
env:
- *py36_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py36
script:
- ./build-support/bin/ci.sh -n

- <<: *py36_linux_test_config
name: "Python contrib tests with Pantsd (Py3.6 PEX)"
stage: *test_cron
env:
- *py36_linux_test_config_env
- *run_tests_under_pantsd
- CACHE_NAME=linuxcontribtests.py36
script:
- ./build-support/bin/ci.sh -n

- <<: *py37_linux_test_config
name: "Python contrib tests (Py3.7 PEX)"
env:
- *py37_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py37
script:
- ./build-support/bin/ci.sh -7n

- <<: *py27_osx_10_12_sanity_check
- <<: *py36_osx_10_12_sanity_check
- <<: *py37_osx_10_12_sanity_check
Expand Down
39 changes: 10 additions & 29 deletions build-support/bin/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function usage() {
cat <<EOF
Runs commons tests for local or hosted CI.

Usage: $0 (-h|-2fxbkmrjlpuneycitzsw)
Usage: $0 (-h|-2fxbkmrjlpuecitzsw)
-h print out this help message
-2 Run using Python 2.7 (defaults to using Python 3.6).
-7 Run using Python 3.7 (defaults to using Python 3.6).
Expand All @@ -31,14 +31,9 @@ Usage: $0 (-h|-2fxbkmrjlpuneycitzsw)
if running core python tests, divide them into
TOTAL_SHARDS shards and just run those in SHARD_NUMBER
to run only even tests: '-u 0/2', odd: '-u 1/2'
-n run contrib python tests
-e run rust tests
-s run clippy on rust code
-a run cargo audit of rust dependencies
-y SHARD_NUMBER/TOTAL_SHARDS
if running contrib python tests, divide them into
TOTAL_SHARDS shards and just run those in SHARD_NUMBER
to run only even tests: '-u 0/2', odd: '-u 1/2'
-c run pants integration tests (includes examples and testprojects)
-i SHARD_NUMBER/TOTAL_SHARDS
if running integration tests, divide them into
Expand All @@ -56,10 +51,9 @@ EOF

# No python test sharding (1 shard) by default.
python_unit_shard="0/1"
python_contrib_shard="0/1"
python_intg_shard="0/1"

while getopts "h27fxbmrjlpeasu:ny:ci:tz" opt; do
while getopts "h27fxbmrjlpeasu:ci:tz" opt; do
case ${opt} in
h) usage ;;
2) python_two="true" ;;
Expand All @@ -76,8 +70,6 @@ while getopts "h27fxbmrjlpeasu:ny:ci:tz" opt; do
e) run_rust_tests="true" ;;
a) run_cargo_audit="true" ;;
s) run_rust_clippy="true" ;;
n) run_contrib="true" ;;
y) python_contrib_shard=${OPTARG} ;;
c) run_integration="true" ;;
i) python_intg_shard=${OPTARG} ;;
t) run_lint="true" ;;
Expand Down Expand Up @@ -207,26 +199,13 @@ if [[ "${run_python:-false}" == "true" ]]; then
fi
start_travis_section "CoreTests" "Running core python tests${shard_desc}"
(
./pants.pex --tag='-integration' test.pytest --chroot \
--test-pytest-test-shard=${python_unit_shard} \
src/python:: tests/python:: -- ${PYTEST_PASSTHRU_ARGS}
./pants.pex --tag='-integration' --exclude-target-regexp='.*/testprojects/.*' \
test.pytest --test-pytest-chroot --test-pytest-test-shard=${python_unit_shard} \
src/python:: tests/python:: contrib:: -- ${PYTEST_PASSTHRU_ARGS}
) || die "Core python test failure"
end_travis_section
fi

if [[ "${run_contrib:-false}" == "true" ]]; then
if [[ "0/1" != "${python_contrib_shard}" ]]; then
shard_desc=" [shard ${python_contrib_shard}]"
fi
start_travis_section "ContribTests" "Running contrib python tests${shard_desc}"
(
./pants.pex --exclude-target-regexp='.*/testprojects/.*' test.pytest \
--test-pytest-test-shard=${python_contrib_shard} \
contrib:: -- ${PYTEST_PASSTHRU_ARGS}
) || die "Contrib python test failure"
end_travis_section
fi

if [[ "${run_rust_tests:-false}" == "true" ]]; then
start_travis_section "RustTests" "Running Pants rust tests"
(
Expand Down Expand Up @@ -281,9 +260,11 @@ if [[ "${run_integration:-false}" == "true" ]]; then
fi
start_travis_section "IntegrationTests" "Running Pants Integration tests${shard_desc}"
(
./pants.pex --tag='+integration' test.pytest \
--test-pytest-test-shard=${python_intg_shard} \
src/python:: tests/python:: -- ${PYTEST_PASSTHRU_ARGS}
# NB: We use test_testprojects_integration.py to specifically run the ones that
# we care about, and skip the rest.
./pants.pex --tag='+integration' --exclude-target-regexp='.*/testprojects/.*' \
test.pytest --test-pytest-test-shard=${python_intg_shard} \
src/python:: tests/python:: contrib:: -- ${PYTEST_PASSTHRU_ARGS}
) || die "Pants Integration test failure"
end_travis_section
fi
Expand Down
35 changes: 0 additions & 35 deletions build-support/travis/travis.yml.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -962,41 +962,6 @@ matrix:
- <<: *linux_rust_tests
- <<: *osx_rust_tests

- <<: *py27_linux_test_config
name: "Python contrib tests (Py2.7 PEX)"
stage: *test
env:
- *py27_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py27
script:
- ./build-support/bin/ci.sh -2n

- <<: *py36_linux_test_config
name: "Python contrib tests (Py3.6 PEX)"
env:
- *py36_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py36
script:
- ./build-support/bin/ci.sh -n

- <<: *py36_linux_test_config
name: "Python contrib tests with Pantsd (Py3.6 PEX)"
stage: *test_cron
env:
- *py36_linux_test_config_env
- *run_tests_under_pantsd
- CACHE_NAME=linuxcontribtests.py36
script:
- ./build-support/bin/ci.sh -n

- <<: *py37_linux_test_config
name: "Python contrib tests (Py3.7 PEX)"
env:
- *py37_linux_test_config_env
- CACHE_NAME=linuxcontribtests.py37
script:
- ./build-support/bin/ci.sh -7n

- <<: *py27_osx_10_12_sanity_check
- <<: *py36_osx_10_12_sanity_check
- <<: *py37_osx_10_12_sanity_check
Expand Down