From 33793102b52a61ed320a30fbe313ceb8bf27c52a Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Mon, 27 Jul 2020 19:42:52 -0700 Subject: [PATCH 1/3] Only skip building wheels on PR builds [ci skip-rust] [ci skip-build-wheels] --- build-support/githooks/prepare-commit-msg | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-support/githooks/prepare-commit-msg b/build-support/githooks/prepare-commit-msg index 3b2d715eaa0..21ce89551ca 100755 --- a/build-support/githooks/prepare-commit-msg +++ b/build-support/githooks/prepare-commit-msg @@ -58,7 +58,9 @@ cat <> "${COMMIT_MSG_FILEPATH}" EOF fi -if [[ "${HAS_WHEELS_SKIP}" -eq 1 ]] && [ "${NUM_RELEASE_FILES}" -eq 0 ]; then +# We only skip building wheels if on a PR build, even if the user put the skip label in the merged +# commit message. +if [[ "${TRAVIS_PULL_REQUEST}" -ne false ]] && [[ "${HAS_WHEELS_SKIP}" -eq 1 ]] && [ "${NUM_RELEASE_FILES}" -eq 0 ]; then cat <> "${COMMIT_MSG_FILEPATH}" # Building wheels and fs_util will be skipped. Delete if not intended. From 3f84b24778e8db8e771818c9e367a52a6248b0a9 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Mon, 27 Jul 2020 20:36:05 -0700 Subject: [PATCH 2/3] Use a better approach The old one didn't actually work correctly. Locally, `TRAVIS_PULL_REQUEST` is never set, meaning that the skip label would never be added. --- .travis.yml | 6 ++++-- build-support/bin/generate_travis_yml.py | 4 +++- build-support/githooks/prepare-commit-msg | 4 +--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5144fac07b4..26ca5d8c816 100644 --- a/.travis.yml +++ b/.travis.yml @@ -615,7 +615,8 @@ jobs: - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.linux - if: commit_message !~ /\[ci skip-build-wheels\]/ + if: commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, + cron) language: python name: Build Linux wheels and fs_util os: linux @@ -668,7 +669,8 @@ jobs: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.osx - if: commit_message !~ /\[ci skip-build-wheels\]/ + if: commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, + cron) language: generic name: Build macOS wheels and fs_util os: osx diff --git a/build-support/bin/generate_travis_yml.py b/build-support/bin/generate_travis_yml.py index 5c5cfe1529c..b30d97eb41a 100644 --- a/build-support/bin/generate_travis_yml.py +++ b/build-support/bin/generate_travis_yml.py @@ -436,7 +436,9 @@ def osx_shard( # See https://docs.travis-ci.com/user/conditions-v1. SKIP_RUST_CONDITION = r"commit_message !~ /\[ci skip-rust\]/" -SKIP_WHEELS_CONDITION = r"commit_message !~ /\[ci skip-build-wheels\]/" +SKIP_WHEELS_CONDITION = ( + r"commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, cron)" +) # ---------------------------------------------------------------------- # Bootstrap engine diff --git a/build-support/githooks/prepare-commit-msg b/build-support/githooks/prepare-commit-msg index 21ce89551ca..3b2d715eaa0 100755 --- a/build-support/githooks/prepare-commit-msg +++ b/build-support/githooks/prepare-commit-msg @@ -58,9 +58,7 @@ cat <> "${COMMIT_MSG_FILEPATH}" EOF fi -# We only skip building wheels if on a PR build, even if the user put the skip label in the merged -# commit message. -if [[ "${TRAVIS_PULL_REQUEST}" -ne false ]] && [[ "${HAS_WHEELS_SKIP}" -eq 1 ]] && [ "${NUM_RELEASE_FILES}" -eq 0 ]; then +if [[ "${HAS_WHEELS_SKIP}" -eq 1 ]] && [ "${NUM_RELEASE_FILES}" -eq 0 ]; then cat <> "${COMMIT_MSG_FILEPATH}" # Building wheels and fs_util will be skipped. Delete if not intended. From 2dbe989cb0714d7cbe2fb4be96aa272b1af909a6 Mon Sep 17 00:00:00 2001 From: Eric Arellano Date: Mon, 27 Jul 2020 20:39:23 -0700 Subject: [PATCH 3/3] Or, not and --- .travis.yml | 4 ++-- build-support/bin/generate_travis_yml.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 26ca5d8c816..55c5d38614b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -615,7 +615,7 @@ jobs: - PANTS_REMOTE_CA_CERTS_PATH=/usr/lib/google-cloud-sdk/lib/third_party/grpc/_cython/_credentials/roots.pem - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.linux - if: commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, + if: commit_message !~ /\[ci skip-build-wheels\]/ OR type NOT IN (pull_request, cron) language: python name: Build Linux wheels and fs_util @@ -669,7 +669,7 @@ jobs: - BOOTSTRAPPED_PEX_KEY_SUFFIX=py36.osx - PREPARE_DEPLOY=1 - CACHE_NAME=wheels.osx - if: commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, + if: commit_message !~ /\[ci skip-build-wheels\]/ OR type NOT IN (pull_request, cron) language: generic name: Build macOS wheels and fs_util diff --git a/build-support/bin/generate_travis_yml.py b/build-support/bin/generate_travis_yml.py index b30d97eb41a..0c5671f2ac0 100644 --- a/build-support/bin/generate_travis_yml.py +++ b/build-support/bin/generate_travis_yml.py @@ -437,7 +437,7 @@ def osx_shard( # See https://docs.travis-ci.com/user/conditions-v1. SKIP_RUST_CONDITION = r"commit_message !~ /\[ci skip-rust\]/" SKIP_WHEELS_CONDITION = ( - r"commit_message !~ /\[ci skip-build-wheels\]/ AND type NOT IN (pull_request, cron)" + r"commit_message !~ /\[ci skip-build-wheels\]/ OR type NOT IN (pull_request, cron)" ) # ----------------------------------------------------------------------