Skip to content

chore: replace custom cache step with config#11572

Merged
di merged 2 commits into
pypi:mainfrom
miketheman:miketheman/better-gha-cache
Jun 15, 2022
Merged

chore: replace custom cache step with config#11572
di merged 2 commits into
pypi:mainfrom
miketheman:miketheman/better-gha-cache

Conversation

@miketheman

Copy link
Copy Markdown
Member

The actions/setup-python@v2 and higher included a built-in cache
restore and post-run save step, meaning we can now retire our custom
steps for the configuration we want and gain some speed here.

Refs: actions/setup-python#266
Refs: https://github.com/actions/setup-python#caching-packages-dependencies

The actions/setup/node@v2 introduced support for configuring cache for
npm.
Since we use defaults, no changes are necessary other than setting the
installer type.

Refs: actions/setup-node#272

Signed-off-by: Mike Fiedler miketheman@gmail.com

@miketheman miketheman force-pushed the miketheman/better-gha-cache branch from 142169a to 8b53d83 Compare June 12, 2022 15:36
@miketheman

Copy link
Copy Markdown
Member Author

This does not impair existing caching behaviors, as the main addition is the post-action cache save, which due to the structure of the CI jobs, will collide on save - first one wins. Example: https://github.com/pypa/warehouse/runs/6850862495?check_suite_focus=true#step:16:3

I'm thinking about a general refactor of the steps here - and introducing a step-based workflow that runs the Dependencies job first - which should set up the cache for all other steps, and thus speed everything up a bit - saving ~1.5 minutes on every python-based step.
Should I attempt that in this scope as well, or save for another refactor?

@miketheman

Copy link
Copy Markdown
Member Author

Should I attempt that in this scope as well, or save for another refactor?

Upon further testing, looks like the downloads are cached, which is fine. Both node_modules and the python environments are not cached/restored between each step, so there won't be much savings anyhow - we can live with the current change of cache/restore of the download dependencies and take a little bit of time savings.

@di

di commented Jun 15, 2022

Copy link
Copy Markdown
Member

@miketheman I'm having a hard time determining if you're ready for this PR to be merged?

@miketheman

Copy link
Copy Markdown
Member Author

@di yes, this is ready for merge. I'll keep an eye on vigor the next few PRs and merges, and continue to think about how cache can improve.

The `actions/setup-python@v2` and higher included a built-in cache
restore and post-run save step, meaning we can now retire our custom
steps for the configuration we want and gain some speed here.

Refs: actions/setup-python#266
Refs: https://github.com/actions/setup-python#caching-packages-dependencies

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
The `actions/setup/node@v2` introduced support for configuring cache for
npm.
Since we use defaults, no changes are necessary other than setting the
installer type.

Refs: actions/setup-node#272

Signed-off-by: Mike Fiedler <miketheman@gmail.com>
@miketheman miketheman force-pushed the miketheman/better-gha-cache branch from 8b53d83 to 9e3516a Compare June 15, 2022 12:57
@di di merged commit ac62bb7 into pypi:main Jun 15, 2022
@miketheman miketheman deleted the miketheman/better-gha-cache branch June 15, 2022 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants