Skip to content

Conversation

@RBusarow
Copy link
Contributor

@RBusarow RBusarow commented Jun 26, 2023

Removed

  • don't bother caching/restoring ~/.gradle/wrapper with actions/cache/___ steps.
      - It's already cached by gradle/gradle-build-action
  • don't use cross-OS archiving.
      - Gradle doesn't seem to like it, even just going between Ubuntu and MacOS.
  • remove the lookup-only toggle for the initial cache-restore step (default is false).
      - The property was left there in error.  If we get a cache hit on the cache-write-key, we definitely want to download it.

Added

  • make an explicit default of 'null' for cache keys, and check if the value is 'null' in a step's if condition instead of just checking whether a value is there.
      - The gradle-task-with-commit action forwards its keys to this action.  Prior to this, if no key was specified when invoking that action, the gradle-task-with-commit action passes a key of '' to the gradle-task action.  The result would be saving and restoring a blank key with who-knows-what in the cache.
  • cache every project build directory (./**/build/**) since they tend to be quite small
  • add the ${{runner.os}}- prefix to key and restore-keys arguments.
      - Otherwise, caches for MacOS and Ubuntu would have the same keys -- which is bad when cross-OS archiving is disabled.

### Removed

- don't bother caching/restoring `~/.gradle/wrapper` with `actions/cache/___` steps.
  - It's already cached by `gradle/gradle-build-action`
- don't use cross-OS archiving.
  - Gradle doesn't seem to like it, even just going between Ubuntu and MacOS.
- remove the `lookup-only` toggle for the initial cache-restore step (default is false).
  - The property was left there in error.  If we get a cache hit on the `cache-write-key`, we definitely want to download it.

### Added

- make an explicit default of 'null' for cache keys, and check if the value is 'null' in a step's `if` condition instead of just checking whether a value is there.
  - The `gradle-task-with-commit` action forwards its keys to this action.  Prior to this, if no key was specified when invoking that action, the `gradle-task-with-commit` action passes a key of '' to the `gradle-task` action.  The result would be saving and restoring a blank key with who-knows-what in the cache.
- cache every project build directory (`./**/build/**`) since they tend to be quite small
- add the `${{runner.os}}-` prefix to `key` and `restore-keys` arguments.
  - Otherwise, caches for MacOS and Ubuntu would have the same keys -- which is bad when cross-OS archiving is disabled.
@RBusarow RBusarow force-pushed the rick/caching_strategies branch from 74499d8 to 3f6a188 Compare June 26, 2023 15:05
@RBusarow RBusarow marked this pull request as ready for review June 26, 2023 17:19
@RBusarow RBusarow requested review from a team and zach-klippenstein as code owners June 26, 2023 17:19
@RBusarow RBusarow merged commit a735e08 into main Jun 26, 2023
@RBusarow RBusarow deleted the rick/caching_strategies branch June 26, 2023 17:20
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.

3 participants