diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index 122db3963575..7f271ff0819f 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -128,22 +128,6 @@ def to_dict(self): steps.extend([{"run": l} for l in self.install_steps]) steps.extend([{"run": 'pip install "fsspec>=2023.5.0,<2023.10.0"'}]) steps.extend([{"run": "pip install pytest-subtests"}]) - steps.append( - { - "save_cache": { - "key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-pip-" + '{{ checksum "setup.py" }}', - "paths": ["~/.cache/pip"], - } - } - ) - steps.append( - { - "save_cache": { - "key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-site-packages-" + '{{ checksum "setup.py" }}', - "paths": ["~/.pyenv/versions/"], - } - } - ) steps.append({"run": {"name": "Show installed libraries and their versions", "command": "pip freeze | tee installed.txt"}}) steps.append({"store_artifacts": {"path": "~/transformers/installed.txt"}}) @@ -264,6 +248,25 @@ def to_dict(self): steps.append({"store_artifacts": {"path": "~/transformers/tests_output.txt"}}) steps.append({"store_artifacts": {"path": "~/transformers/reports"}}) + + # save cache at the end: so pytest step runs before cache saving and we can see results earlier + steps.append( + { + "save_cache": { + "key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-pip-" + '{{ checksum "setup.py" }}', + "paths": ["~/.cache/pip"], + } + } + ) + steps.append( + { + "save_cache": { + "key": f"v{self.cache_version}-{self.cache_name}-{cache_branch_prefix}-site-packages-" + '{{ checksum "setup.py" }}', + "paths": ["~/.pyenv/versions/"], + } + } + ) + job["steps"] = steps return job