-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ray-project/ray
Signed-off-by: Balaji Veeramani <[email protected]>
- Loading branch information
Showing
132 changed files
with
1,648 additions
and
643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("@rules_python//python:defs.bzl", "py_test") | ||
load("@py_deps_buildkite//:requirements.bzl", ci_require = "requirement") | ||
|
||
py_test( | ||
name = "test_conditional_testing", | ||
size = "small", | ||
srcs = ["test_conditional_testing.py"], | ||
data = [ | ||
":determine_tests_to_run.py", | ||
], | ||
exec_compatible_with = ["//:hermetic_python"], | ||
tags = [ | ||
"ci_unit", | ||
"team:ci", | ||
], | ||
deps = [ | ||
ci_require("bazel-runfiles"), | ||
ci_require("pytest"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import os | ||
import subprocess | ||
import sys | ||
import tempfile | ||
|
||
import runfiles | ||
import pytest | ||
|
||
_REPO_NAME = "com_github_ray_project_ray" | ||
_runfiles = runfiles.Create() | ||
|
||
|
||
def test_conditional_testing_pull_request(): | ||
script = _runfiles.Rlocation(_REPO_NAME + "/ci/pipeline/determine_tests_to_run.py") | ||
|
||
test_cases = [ | ||
(["ci/pipeline/test_conditional_testing.py"], {"lint", "tools"}), | ||
( | ||
["python/ray/data/__init__.py"], | ||
{"lint", "data", "linux_wheels", "macos_wheels", "ml", "train"}, | ||
), | ||
] | ||
|
||
with tempfile.TemporaryDirectory() as origin, tempfile.TemporaryDirectory() as workdir: | ||
subprocess.check_call(["git", "init", "--bare"], cwd=origin) | ||
subprocess.check_call(["git", "init"], cwd=workdir) | ||
subprocess.check_call( | ||
["git", "config", "user.email", "[email protected]"], cwd=workdir | ||
) | ||
subprocess.check_call( | ||
["git", "config", "user.name", "Ray CI Test"], cwd=workdir | ||
) | ||
subprocess.check_call(["git", "remote", "add", "origin", origin], cwd=workdir) | ||
|
||
with open(os.path.join(workdir, "README.md"), "w") as f: | ||
f.write("# README\n") | ||
subprocess.check_call(["git", "add", "README.md"], cwd=workdir) | ||
subprocess.check_call(["git", "commit", "-m", "init with readme"], cwd=workdir) | ||
subprocess.check_call(["git", "push", "origin", "master"], cwd=workdir) | ||
|
||
for test_case in test_cases: | ||
subprocess.check_call( | ||
["git", "checkout", "-B", "pr01", "master"], cwd=workdir | ||
) | ||
|
||
add_files = test_case[0] | ||
for f in add_files: | ||
dirname = os.path.dirname(f) | ||
if dirname: | ||
os.makedirs(os.path.join(workdir, dirname), exist_ok=True) | ||
with open(os.path.join(workdir, f), "w") as f: | ||
f.write("...\n") | ||
|
||
subprocess.check_call(["git", "add", "."], cwd=workdir) | ||
subprocess.check_call( | ||
["git", "commit", "-m", "add test files"], cwd=workdir | ||
) | ||
commit = ( | ||
subprocess.check_output( | ||
["git", "show", "HEAD", "-q", "--format=%H"], cwd=workdir | ||
) | ||
.decode() | ||
.strip() | ||
) | ||
|
||
envs = os.environ.copy() | ||
envs["BUILDKITE"] = "true" | ||
envs["BUILDKITE_PULL_REQUEST_BASE_BRANCH"] = "master" | ||
envs["BUILDKITE_PULL_REQUEST"] = "true" | ||
envs["BUILDKITE_COMMIT"] = commit | ||
|
||
output = ( | ||
subprocess.check_output([sys.executable, script], env=envs, cwd=workdir) | ||
.decode() | ||
.strip() | ||
) | ||
tags = output.split() | ||
|
||
want = test_case[1] | ||
assert want == set(tags), f"want {want}, got {tags}" | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(pytest.main(["-vv", __file__])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.