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

Refactor producing cache keys in GHA jobs #1389

Closed
wants to merge 1 commit into from

Conversation

webknjaz
Copy link
Member

This change makes the GHA cache dirs and keys calculated dynamically per recommendation @ #1378 (comment).

Changelog-friendly one-liner: $sbj (not user-facing)

Contributor checklist
  • Provided the tests for the changes.
  • Gave a clear one-line description in the PR (that the maintainers can add to CHANGELOG.md on release).
  • Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

@webknjaz webknjaz added refactor Refactoring code maintenance Related to maintenance processes enhancement Improvements to functionality ci Related to continuous integration tasks labels Apr 22, 2021
@webknjaz webknjaz requested a review from atugushev April 22, 2021 15:29
@webknjaz webknjaz mentioned this pull request Apr 22, 2021
3 tasks
@webknjaz webknjaz force-pushed the maintenance/gha-cache-dynamic-keys branch from 8aad088 to 97aaf40 Compare April 22, 2021 15:34

- name: Calculate cache metadata
id: cache-meta
shell: python
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder can we put this script into a python file and run it instead?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea. Moving the context out of the workflow makes it harder to follow and forces people to look up external sources. This would be different if it was needed outside of GHA, of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, hashFiles() is only accessible within workflows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be possible to make it a composite action but it looks like an overkill.

@ssbarnea
Copy link
Member

@webknjaz Please make it draft until is ready for review and merge.

@hugovk hugovk mentioned this pull request Feb 4, 2022
4 tasks
@hugovk
Copy link
Member

hugovk commented Feb 4, 2022

pip can now be cached via actions/setup-python to save a lot of config:

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

Please see #1571 for an alternative.

@hugovk hugovk closed this in #1573 Mar 15, 2022
@atugushev atugushev deleted the maintenance/gha-cache-dynamic-keys branch August 9, 2023 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to continuous integration tasks enhancement Improvements to functionality maintenance Related to maintenance processes refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants