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

feat: save cache on job failure #16

Merged
merged 1 commit into from
Feb 20, 2024
Merged

feat: save cache on job failure #16

merged 1 commit into from
Feb 20, 2024

Conversation

LNSD
Copy link
Contributor

@LNSD LNSD commented Feb 20, 2024

Context

As stated by @TimJentzsch in #14:

Unfortunately, the cache action only saves the cache if the workflow succeeded.
For cargo, this doesn't make much sense as e.g. a failing test doesn't influence the build artifacts.

The difficulty here is that the action does not provide any option to configure this.
We could use the actions/cache@main/save action to manually save the cache, but then we can't put it at the end of the job, since compose actions don't have a way to set a post action to my knowledge...

Proposed Solution

The actions/cache action was upgraded to v4 in the previous pull request. This update brought forth the save-always option, allowing the cache to be preserved even in the event of a preceding step failure.

To align with this enhancement, I am introducing the save-always action input to the cargo-cache action and cascading it to the internal actions/cache step. If the save-always action parameter is not set, by default, the cache will always be saved.

This PR resolves #14

Copy link
Collaborator

@TimJentzsch TimJentzsch left a comment

Choose a reason for hiding this comment

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

Sounds good, thank you!

@TimJentzsch
Copy link
Collaborator

Actually, Alice is recovering from the Bevy release so I'll just go ahead and merge this

@TimJentzsch TimJentzsch removed the request for review from alice-i-cecile February 20, 2024 19:19
@TimJentzsch TimJentzsch merged commit c7e8aa4 into Leafwing-Studios:main Feb 20, 2024
@LNSD LNSD deleted the feat-save-always branch February 20, 2024 19:19
@TimJentzsch
Copy link
Collaborator

@LNSD Released as v1.2.0 and v1!

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.

Also save cache on job failure
2 participants