Skip to content

Commit

Permalink
Add dedicated cron bootstrap stage to CI to avoid unnecessarily build…
Browse files Browse the repository at this point in the history
…ing Python 3 (#7353)

### Problem
Nightly CI (i.e. the Cron job we run every night around midnight) runs exclusively with Python 2.7, yet we still bootstrap Python 3.6 every time. This adds an unnecessary 40 minutes of CI every night (total CI time, not wall time).

Further, once we add Py37 to the cron job in #7261, we will need to avoid bootstrapping Py37 during daily CI (i.e. what we run every time we open a PR or merge to master), else we add 40 minutes of total CI time (not wall time) to every single daily CI run.

This PR both helps now and is pre-work for #7261.

### Solution
* Introduce new stage `bootstrap_cron` that only runs during cron job.
* Set up `bootstrap_cron` to only run the Py27 build engine shards.
* Rename `cron` stage to `test_cron` for better parity with daily CI.

### Result
* Daily CI will run identically to before.
* Nightly CI will run with 2 less bootstrap shards, saving 40 minutes of total CI time: https://travis-ci.org/pantsbuild/pants/builds/504357528.
  • Loading branch information
Eric-Arellano committed Mar 12, 2019
1 parent 01a9f8b commit 9a46332
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
18 changes: 13 additions & 5 deletions .travis.yml
Expand Up @@ -25,10 +25,13 @@ env:

# Stages are documented here: https://docs.travis-ci.com/user/build-stages
stages:
- &bootstrap Bootstrap Pants
- name: &bootstrap Bootstrap Pants
if: type != cron
- name: &bootstrap_cron Bootstrap Pants (Cron)
if: type = cron
- name: &test Test Pants
if: type != cron
- name: &cron Cron
- name: &test_cron Test Pants (Cron)
if: type = cron
- name: &build_stable Deploy Pants Pex
if: tag IS present AND tag =~ ^release_.*$
Expand Down Expand Up @@ -139,7 +142,7 @@ base_linux_test_config: &base_linux_test_config
py27_linux_test_config: &py27_linux_test_config
<<: *py27_linux_config
<<: *base_linux_test_config
stage: *cron
stage: *test_cron
env:
- &py27_linux_test_config_env BOOTSTRAPPED_PEX_KEY_SUFFIX=py27.linux

Expand Down Expand Up @@ -194,7 +197,7 @@ base_osx_test_config: &base_osx_test_config
py27_osx_test_config: &py27_osx_test_config
<<: *py27_osx_config
<<: *base_osx_test_config
stage: *cron
stage: *test_cron
env:
- &py27_osx_test_config_env BOOTSTRAPPED_PEX_KEY_SUFFIX=py27.osx

Expand Down Expand Up @@ -373,7 +376,7 @@ cargo_audit: &cargo_audit
os: linux
dist: xenial
sudo: required
stage: *cron
stage: *test_cron
script:
- ./build-support/bin/travis-ci.sh -a

Expand Down Expand Up @@ -685,8 +688,13 @@ deploy_unstable_multiplatform_pex: &deploy_unstable_multiplatform_pex
matrix:
include:
- <<: *py27_linux_build_engine
- <<: *py27_linux_build_engine
stage: *bootstrap_cron
- <<: *py36_linux_build_engine

- <<: *py27_osx_build_engine
- <<: *py27_osx_build_engine
stage: *bootstrap_cron
- <<: *py36_osx_build_engine

- <<: *py27_lint
Expand Down
18 changes: 13 additions & 5 deletions build-support/travis/travis.yml.mustache
Expand Up @@ -18,10 +18,13 @@ env:

# Stages are documented here: https://docs.travis-ci.com/user/build-stages
stages:
- &bootstrap Bootstrap Pants
- name: &bootstrap Bootstrap Pants
if: type != cron
- name: &bootstrap_cron Bootstrap Pants (Cron)
if: type = cron
- name: &test Test Pants
if: type != cron
- name: &cron Cron
- name: &test_cron Test Pants (Cron)
if: type = cron
- name: &build_stable Deploy Pants Pex
if: tag IS present AND tag =~ ^release_.*$
Expand Down Expand Up @@ -129,7 +132,7 @@ base_linux_test_config: &base_linux_test_config
py27_linux_test_config: &py27_linux_test_config
<<: *py27_linux_config
<<: *base_linux_test_config
stage: *cron
stage: *test_cron
env:
- &py27_linux_test_config_env BOOTSTRAPPED_PEX_KEY_SUFFIX=py27.linux

Expand Down Expand Up @@ -176,7 +179,7 @@ base_osx_test_config: &base_osx_test_config
py27_osx_test_config: &py27_osx_test_config
<<: *py27_osx_config
<<: *base_osx_test_config
stage: *cron
stage: *test_cron
env:
- &py27_osx_test_config_env BOOTSTRAPPED_PEX_KEY_SUFFIX=py27.osx

Expand Down Expand Up @@ -337,7 +340,7 @@ cargo_audit: &cargo_audit
os: linux
dist: xenial
sudo: required
stage: *cron
stage: *test_cron
script:
- ./build-support/bin/travis-ci.sh -a
Expand Down Expand Up @@ -632,8 +635,13 @@ deploy_unstable_multiplatform_pex: &deploy_unstable_multiplatform_pex
matrix:
include:
- <<: *py27_linux_build_engine
- <<: *py27_linux_build_engine
stage: *bootstrap_cron
- <<: *py36_linux_build_engine
- <<: *py27_osx_build_engine
- <<: *py27_osx_build_engine
stage: *bootstrap_cron
- <<: *py36_osx_build_engine
- <<: *py27_lint
Expand Down

0 comments on commit 9a46332

Please sign in to comment.