Skip to content

Commit

Permalink
perf: save cache as long as the installation step succeeds (#317) (#319)
Browse files Browse the repository at this point in the history
even if the entire job fails

use environment variable SETUP_TEXLIVE_ACTION_NO_CACHE_ON_FAILURE
to revert to the previous behavior
  • Loading branch information
teatimeguest authored Oct 10, 2024
1 parent fe74583 commit 7def4dc
Show file tree
Hide file tree
Showing 15 changed files with 1,361 additions and 804 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ You can also specify packages by file using the `package-file` input:
### Caching
By default, the action will save `TEXDIR` to cache using [`@actions/cache`].
This is done in the [post-process] of a successfully completed workflow,
so that, for example, LuaTeX font cache files generated in your jobs are
This is done in the [post-process] of a completed workflow job,
so that, for example, LuaTeX font cache files generated in your job are
also saved and restored as part of the cache entry.

If you have problems due to a corrupt cache entry,
Expand Down Expand Up @@ -416,10 +416,11 @@ The action reads the following environment variable:

<!-- U+200B ZERO WIDTH SPACE -->

| Name | Type | Description |
| ------------------------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <code>SETUP_TEXLIVE_ACTION_&#x200B;FORCE_UPDATE_CACHE</code> | String | Setting this to anything other than `0`, the action will use a [unique cache key each time][update-a-cache] to keep the cache up-to-date.<p /><blockquote>:warning:&ensp;Enabling this will consume more [cache space][cache-limits].</blockquote><p /> **Default:**&ensp;<var>unset</var> |
| [`NO_COLOR`](https://no-color.org/) | String | Disable color output. |
| Name | Type | Description |
| ------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <code>SETUP_TEXLIVE_ACTION_&#x200B;FORCE_UPDATE_CACHE</code> | String | Setting this to anything other than `0`, the action will use a [unique cache key each time][update-a-cache] to keep the cache up-to-date.<p /><blockquote>:warning:&ensp;Enabling this will consume more [cache space][cache-limits].</blockquote> |
| <code>SETUP_TEXLIVE_ACTION_&#x200B;NO_CACHE_ON_FAILURE</code> | String | Setting this to anything other than `0`, no cache will be saved when a job fails. |
| [`NO_COLOR`](https://no-color.org/) | String | Disable color output. |

[cache-limits]: https://github.com/actions/cache#cache-limits
[update-a-cache]: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache
Expand Down
10 changes: 9 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,15 @@ runs:
using: node20
main: dist/index.mjs
post: dist/index.mjs
post-if: success()
# - Use `fromJSON` since there are no array literals.
# - Use `toJSON` for strict value comparison.
post-if: >-
contains(
fromJSON('["null", "\"0\""]'),
toJSON(env.SETUP_TEXLIVE_ACTION_NO_CACHE_ON_FAILURE)
)
&& !cancelled()
|| success()
branding:
color: green
icon: type
Loading

0 comments on commit 7def4dc

Please sign in to comment.