Skip to content

Commit

Permalink
Empty circleci config (huggingface#23913)
Browse files Browse the repository at this point in the history
* Try easy first

* Add an empty job

* Fix name

* Fix method
  • Loading branch information
sgugger authored and gojiteji committed Jun 5, 2023
1 parent ccd694a commit 4375fdc
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions .circleci/create_circleci_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.8.12"}]


class EmptyJob:
job_name = "empty"

def to_dict(self):
return {
"working_directory": "~/transformers",
"docker": copy.deepcopy(DEFAULT_DOCKER_IMAGE),
"steps":["checkout"],
}


@dataclass
class CircleCIJob:
name: str
Expand Down Expand Up @@ -573,17 +584,18 @@ def create_circleci_config(folder=None):
if os.path.exists(repo_util_file) and os.path.getsize(repo_util_file) > 0:
jobs.extend(REPO_UTIL_TESTS)

if len(jobs) > 0:
config = {"version": "2.1"}
config["parameters"] = {
# Only used to accept the parameters from the trigger
"nightly": {"type": "boolean", "default": False},
"tests_to_run": {"type": "string", "default": test_list},
}
config["jobs"] = {j.job_name: j.to_dict() for j in jobs}
config["workflows"] = {"version": 2, "run_tests": {"jobs": [j.job_name for j in jobs]}}
with open(os.path.join(folder, "generated_config.yml"), "w") as f:
f.write(yaml.dump(config, indent=2, width=1000000, sort_keys=False))
if len(jobs) == 0:
jobs = [EmptyJob()]
config = {"version": "2.1"}
config["parameters"] = {
# Only used to accept the parameters from the trigger
"nightly": {"type": "boolean", "default": False},
"tests_to_run": {"type": "string", "default": test_list},
}
config["jobs"] = {j.job_name: j.to_dict() for j in jobs}
config["workflows"] = {"version": 2, "run_tests": {"jobs": [j.job_name for j in jobs]}}
with open(os.path.join(folder, "generated_config.yml"), "w") as f:
f.write(yaml.dump(config, indent=2, width=1000000, sort_keys=False))


if __name__ == "__main__":
Expand Down

0 comments on commit 4375fdc

Please sign in to comment.