Improvements to caching (#265)
* Bump actions/cache to v4 to suppress node warnings
* Respect `PUB_CACHE` from the environment
* Cache pub-cache separately from flutter
In order to reduce the extra work that happens when you update your
pubspec.lock, don't use `hashFiles('**/pubspec.lock')` in the hash of
the flutter installation, and separately cache the `.pubspec-cache`.
Also return the `.pub-cache` to `$HOME`, since it's not part of the tool
installation.
* Fix README example of pub-cache-path and document `PUB_CACHE`
This commit is contained in:
@@ -171,11 +171,13 @@ steps:
|
||||
cache: true
|
||||
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache
|
||||
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
|
||||
pub-cache-key: 'flutter-pub:os:-:channel:-:version:-:arch:-:hash:' # optional, change this to force refresh cache of dart pub get dependencies
|
||||
pub-cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:' # optional, change this to specify the cache path
|
||||
architecture: x64 # optional, x64 or arm64
|
||||
- run: flutter --version
|
||||
```
|
||||
|
||||
Note: `cache-key` and `cache-path` has support for several dynamic values:
|
||||
Note: `cache-key`, `pub-cache-key`, and `cache-path` has support for several dynamic values:
|
||||
|
||||
- `:os:`
|
||||
- `:channel:`
|
||||
@@ -199,5 +201,7 @@ steps:
|
||||
echo CHANNEL=${{ steps.flutter-action.outputs.CHANNEL }}
|
||||
echo VERSION=${{ steps.flutter-action.outputs.VERSION }}
|
||||
echo ARCHITECTURE=${{ steps.flutter-action.outputs.ARCHITECTURE }}
|
||||
echo PUB-CACHE-PATH=${{ steps.flutter-action.outputs.PUB-CACHE-PATH }}
|
||||
echo PUB-CACHE-KEY=${{ steps.flutter-action.outputs.PUB-CACHE-KEY }}
|
||||
shell: bash
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user