"git@developer.sourcefind.cn:chenpangpang/transformers.git" did not exist on "7af2791d77e6a04688632b17428a80220cf82576"
Unverified Commit 0b3d092f authored by Sylvain Gugger's avatar Sylvain Gugger Committed by GitHub
Browse files

Empty circleci config (#23913)

* Try easy first

* Add an empty job

* Fix name

* Fix method
parent 8714b964
...@@ -36,6 +36,17 @@ COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "dist": "loadfile", "s": None} ...@@ -36,6 +36,17 @@ COMMON_PYTEST_OPTIONS = {"max-worker-restart": 0, "dist": "loadfile", "s": None}
DEFAULT_DOCKER_IMAGE = [{"image": "cimg/python:3.8.12"}] 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 @dataclass
class CircleCIJob: class CircleCIJob:
name: str name: str
...@@ -573,17 +584,18 @@ def create_circleci_config(folder=None): ...@@ -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: if os.path.exists(repo_util_file) and os.path.getsize(repo_util_file) > 0:
jobs.extend(REPO_UTIL_TESTS) jobs.extend(REPO_UTIL_TESTS)
if len(jobs) > 0: if len(jobs) == 0:
config = {"version": "2.1"} jobs = [EmptyJob()]
config["parameters"] = { config = {"version": "2.1"}
# Only used to accept the parameters from the trigger config["parameters"] = {
"nightly": {"type": "boolean", "default": False}, # Only used to accept the parameters from the trigger
"tests_to_run": {"type": "string", "default": test_list}, "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]}} config["jobs"] = {j.job_name: j.to_dict() for j in jobs}
with open(os.path.join(folder, "generated_config.yml"), "w") as f: config["workflows"] = {"version": 2, "run_tests": {"jobs": [j.job_name for j in jobs]}}
f.write(yaml.dump(config, indent=2, width=1000000, sort_keys=False)) 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__": if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment