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

Make travis only run on changed dirs #85

Merged
merged 3 commits into from
Aug 13, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions scripts/get_tox_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,24 @@ def get_changed_tox_envs(all_envs: bool, travis_strict: bool, plan: bool) -> Non
splits = p.split("/")
# If there's a directory, parse it; otherwise, add placeholder "."
unique_directories.add("." if len(splits) == 1 else splits[0])
unique_directories = list(unique_directories)
# If we only have one and it's a valid tox environment, run that one
if len(unique_directories) == 1 and (unique_directories[0] in default_environments):
run_environments = unique_directories + EXTRA_ENVIRONMENTS
unique_defaults = [d for d in unique_directories if d in default_environments]
# If all changed directories are among the defaults, then only run them
# plus EXTRA_ENVIRONMENTS.
if len(unique_defaults) == len(unique_directories):
run_environments = unique_defaults + EXTRA_ENVIRONMENTS
if plan:
print(
f"Single changed tutorial directory: {unique_directories[0]}, "
f"Changed tutorial directories: {unique_defaults}, "
f"running environments: {run_environments}"
)
print(",".join(run_environments))
# Otherwise, run all environments
else:
if plan:
print(
f"No single changed tutorial directory [{unique_directories}], "
"reverting to all environments"
"Change in non-tutorial directory. "
f"All changes: [{unique_directories}]. "
"Running on all environments."
)
print(",".join(default_environments))

Expand Down