1
0
Fork 0
mirror of https://github.com/actions/setup-go synced 2024-12-23 06:42:41 +00:00

Add nesting

This commit is contained in:
Sergey Dolin 2023-08-30 15:57:32 +02:00
parent 3671db66cb
commit 57dc459658

View file

@ -163,7 +163,7 @@ in different subdirectories. The input supports glob patterns.
If some problem that prevents success caching happens then the action issues the warning in the log and continues the execution of the pipeline. If some problem that prevents success caching happens then the action issues the warning in the log and continues the execution of the pipeline.
**Caching in monorepos** ### Caching in monorepos
```yaml ```yaml
steps: steps:
@ -175,7 +175,7 @@ steps:
- run: go run hello.go - run: go run hello.go
``` ```
**Caching in multirepos** ### Caching in multirepos
`cache-dependency-path` input assepts glob patterns and multi-line values: `cache-dependency-path` input assepts glob patterns and multi-line values:
```yaml ```yaml
@ -200,7 +200,7 @@ steps:
- run: go run hello.go - run: go run hello.go
``` ```
## Multi-target builds ### Multi-target builds
`cache-dependency-path` input used to generate unuque cache key and it is not limited to only `cache-dependency-path` input used to generate unuque cache key and it is not limited to only
dependencies files. The common case is to add a file containing the extr info about the specific dependencies files. The common case is to add a file containing the extr info about the specific
build, for example build target. build, for example build target.
@ -220,7 +220,7 @@ steps:
- run: go run hello.go - run: go run hello.go
``` ```
## Invalidate cache when source code changes ### Invalidate cache when source code changes
Besides the dependencise the action caches the build outputs Besides the dependencise the action caches the build outputs
([GOCACHE](https://pkg.go.dev/cmd/go#hdr-Build_and_test_caching) directory) but by default this ([GOCACHE](https://pkg.go.dev/cmd/go#hdr-Build_and_test_caching) directory) but by default this
cache is not update in order to avoid unpredictable and frequent cache invaldation. Nevertheless cache is not update in order to avoid unpredictable and frequent cache invaldation. Nevertheless
@ -245,7 +245,7 @@ of changes made in the repo.
- run: go run hello.go - run: go run hello.go
``` ```
## 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 the action are limited for the simplest builds and can be ineffective in the real world
use cases. If the build requires fine-grained turning the built-in caching should be disabled and 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. [actions/cache](https://github.com/actions/cache) should be used.
@ -297,16 +297,16 @@ build:
``` ```
## Restore-only caches ### Restore-only caches
If there are several builds on the same repo it might make sense to create a cache in one build and use it in the If there are several builds on the same repo it might make sense to create a cache in one build and use it in the
others. The action [actions/cache/restore](https://github.com/marketplace/actions/cache-restore) others. The action [actions/cache/restore](https://github.com/marketplace/actions/cache-restore)
should be used in this case. should be used in this case.
## Generate different caches ### Generate different caches
This advanced use case assumes manual definition of cache key and requires the use of This advanced use case assumes manual definition of cache key and requires the use of
[actions/cache](https://github.com/actions/cache/blob/main/examples.md#go---modules) [actions/cache](https://github.com/actions/cache/blob/main/examples.md#go---modules)
## Parallel builds ### Parallel builds
To avoid race conditions during the parallel builds they should either To avoid race conditions during the parallel builds they should either
[generate their own caches](#generate-different-caches), or create the cache [generate their own caches](#generate-different-caches), or create the cache
for only one build and [restore](#restore-only-caches) that cache in the other builds. for only one build and [restore](#restore-only-caches) that cache in the other builds.