2019-03-15 22:23:54 -07:00
|
|
|
# Script used for checking changes for incremental testing cases
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from __future__ import division
|
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
2019-09-13 21:36:56 -07:00
|
|
|
import sys
|
|
|
|
from functools import partial
|
|
|
|
from pprint import pformat
|
2019-03-15 22:23:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
def list_changed_files(commit_range):
|
|
|
|
"""Returns a list of names of files changed in the given commit range.
|
|
|
|
|
|
|
|
The function works by opening a subprocess and running git. If an error
|
|
|
|
occurs while running git, the script will abort.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
commit_range (string): The commit range to diff, consisting of the two
|
|
|
|
commit IDs separated by \"..\"
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
list: List of changed files within the commit range
|
|
|
|
"""
|
|
|
|
|
|
|
|
command = ["git", "diff", "--name-only", commit_range]
|
|
|
|
out = subprocess.check_output(command)
|
|
|
|
return [s.strip() for s in out.decode().splitlines() if s is not None]
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
|
|
RAY_CI_TUNE_AFFECTED = 0
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 0
|
2019-09-13 21:36:56 -07:00
|
|
|
RAY_CI_SERVE_AFFECTED = 0
|
2019-03-15 22:23:54 -07:00
|
|
|
RAY_CI_JAVA_AFFECTED = 0
|
|
|
|
RAY_CI_PYTHON_AFFECTED = 0
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 0
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 0
|
2019-12-10 20:33:24 +08:00
|
|
|
RAY_CI_STREAMING_CPP_AFFECTED = 0
|
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 0
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 0
|
2019-03-15 22:23:54 -07:00
|
|
|
|
|
|
|
if os.environ["TRAVIS_EVENT_TYPE"] == "pull_request":
|
|
|
|
|
|
|
|
files = list_changed_files(os.environ["TRAVIS_COMMIT_RANGE"].replace(
|
|
|
|
"...", ".."))
|
|
|
|
|
2019-09-13 21:36:56 -07:00
|
|
|
print(pformat(files), file=sys.stderr)
|
|
|
|
|
2019-03-15 22:23:54 -07:00
|
|
|
skip_prefix_list = [
|
|
|
|
"doc/", "examples/", "dev/", "docker/", "kubernetes/", "site/"
|
|
|
|
]
|
|
|
|
|
|
|
|
for changed_file in files:
|
|
|
|
if changed_file.startswith("python/ray/tune/"):
|
|
|
|
RAY_CI_TUNE_AFFECTED = 1
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
|
|
|
elif changed_file.startswith("python/ray/rllib/"):
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-09-13 21:36:56 -07:00
|
|
|
elif changed_file.startswith("python/ray/experimental/serve"):
|
|
|
|
RAY_CI_SERVE_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
elif changed_file.startswith("python/"):
|
|
|
|
RAY_CI_TUNE_AFFECTED = 1
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
2019-09-13 21:36:56 -07:00
|
|
|
RAY_CI_SERVE_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
RAY_CI_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
elif changed_file.startswith("java/"):
|
|
|
|
RAY_CI_JAVA_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
elif any(
|
|
|
|
changed_file.startswith(prefix)
|
|
|
|
for prefix in skip_prefix_list):
|
|
|
|
# nothing is run but linting in these cases
|
|
|
|
pass
|
|
|
|
elif changed_file.startswith("src/"):
|
|
|
|
RAY_CI_TUNE_AFFECTED = 1
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
2019-09-13 21:36:56 -07:00
|
|
|
RAY_CI_SERVE_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
RAY_CI_JAVA_AFFECTED = 1
|
|
|
|
RAY_CI_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
RAY_CI_STREAMING_CPP_AFFECTED = 1
|
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
elif changed_file.startswith("streaming/src"):
|
|
|
|
RAY_CI_STREAMING_CPP_AFFECTED = 1
|
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
elif changed_file.startswith("streaming/python"):
|
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
elif changed_file.startswith("streaming/java"):
|
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
else:
|
|
|
|
RAY_CI_TUNE_AFFECTED = 1
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
2019-09-13 21:36:56 -07:00
|
|
|
RAY_CI_SERVE_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
RAY_CI_JAVA_AFFECTED = 1
|
|
|
|
RAY_CI_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
RAY_CI_STREAMING_CPP_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
else:
|
|
|
|
RAY_CI_TUNE_AFFECTED = 1
|
|
|
|
RAY_CI_RLLIB_AFFECTED = 1
|
2019-09-13 21:36:56 -07:00
|
|
|
RAY_CI_SERVE_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
RAY_CI_JAVA_AFFECTED = 1
|
|
|
|
RAY_CI_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_LINUX_WHEELS_AFFECTED = 1
|
|
|
|
RAY_CI_MACOS_WHEELS_AFFECTED = 1
|
2019-12-10 20:33:24 +08:00
|
|
|
RAY_CI_STREAMING_CPP_AFFECTED = 1
|
2019-12-22 10:56:05 +08:00
|
|
|
RAY_CI_STREAMING_PYTHON_AFFECTED = 1
|
|
|
|
RAY_CI_STREAMING_JAVA_AFFECTED = 1
|
2019-03-15 22:23:54 -07:00
|
|
|
|
2019-09-13 21:36:56 -07:00
|
|
|
# Log the modified environment variables visible in console.
|
|
|
|
for output_stream in [sys.stdout, sys.stderr]:
|
|
|
|
_print = partial(print, file=output_stream)
|
|
|
|
_print("export RAY_CI_TUNE_AFFECTED={}".format(RAY_CI_TUNE_AFFECTED))
|
|
|
|
_print("export RAY_CI_RLLIB_AFFECTED={}".format(RAY_CI_RLLIB_AFFECTED))
|
|
|
|
_print("export RAY_CI_SERVE_AFFECTED={}".format(RAY_CI_SERVE_AFFECTED))
|
|
|
|
_print("export RAY_CI_JAVA_AFFECTED={}".format(RAY_CI_JAVA_AFFECTED))
|
|
|
|
_print(
|
|
|
|
"export RAY_CI_PYTHON_AFFECTED={}".format(RAY_CI_PYTHON_AFFECTED))
|
|
|
|
_print("export RAY_CI_LINUX_WHEELS_AFFECTED={}"
|
|
|
|
.format(RAY_CI_LINUX_WHEELS_AFFECTED))
|
|
|
|
_print("export RAY_CI_MACOS_WHEELS_AFFECTED={}"
|
|
|
|
.format(RAY_CI_MACOS_WHEELS_AFFECTED))
|
2019-12-10 20:33:24 +08:00
|
|
|
_print("export RAY_CI_STREAMING_CPP_AFFECTED={}"
|
|
|
|
.format(RAY_CI_STREAMING_CPP_AFFECTED))
|
|
|
|
_print("export RAY_CI_STREAMING_PYTHON_AFFECTED={}"
|
|
|
|
.format(RAY_CI_STREAMING_PYTHON_AFFECTED))
|
2019-12-22 10:56:05 +08:00
|
|
|
_print("export RAY_CI_STREAMING_JAVA_AFFECTED={}"
|
|
|
|
.format(RAY_CI_STREAMING_JAVA_AFFECTED))
|