add requested changes

This commit is contained in:
Sergey Dolin 2023-08-30 16:30:41 +02:00
parent ff99eca7af
commit 9b4533e484

View File

@ -209,7 +209,7 @@ env:
GOARCH: ... GOARCH: ...
steps: steps:
- run: echo "$GOOS $GOARCH"> /tmp/env - run: echo "$GOOS $GOARCH" > /tmp/env
- uses: actions/setup-go@v4 - uses: actions/setup-go@v4
with: with:
@ -235,16 +235,14 @@ including the source code files into `cache-dependency-path` input.
``` ```
### Caching with actions/cache ### Caching with actions/cache
The caching capabilities of the action are limited for the simplest builds and can be ineffective in the real world The caching capabilities of setup-go are limited to the simplest and most popular use cases. If fine-grained tuning of caching is required, it's recommended to disable the built-in caching and use [actions/cache](https://github.com/actions/cache).
use cases. If the build requires fine-grained turning the built-in caching should be disabled and
[actions/cache](https://github.com/actions/cache) should be used.
Here the sample `actions/cache` configuration with the extending options allowing The example workflow below utilizes the `actions/cache` action and adds flexibility, for instance, it:
- configuring paths to cache - allows to configure cache path
- have different caches for rare changes dependencies and more often changed intermediate build files - allows to have different caches for rare changed dependencies and more often changed intermediate build files
- use `restore-key` input to restore the previous cache even if the current key cache has changed - uses the `restore-key` input to restore the previous cache even if the current key cache has changed
- have different caches intermediate build files of different architectures - has different caches for the compiler's build outputs for different architectures
- have custom cache key for parallel builds - has custom cache keys for parallel builds
```yaml ```yaml
build: build:
@ -269,8 +267,6 @@ build:
path: | path: |
${{ env.cache }} ${{ env.cache }}
key: setup-go-deps-${{ runner.os }}-go-${{ hashFiles('go.sum go.mod') }} key: setup-go-deps-${{ runner.os }}-go-${{ hashFiles('go.sum go.mod') }}
restore-keys: |
setup-go-deps-${{ runner.os }}-go-
- name: - name:
run: echo "$GOOS $GOARCH"> /tmp/env run: echo "$GOOS $GOARCH"> /tmp/env