mirror of
https://github.com/actions/cache.git
synced 2024-11-15 18:43:52 +08:00
Golang example tweak - add go-build
path - rebuild page TOC (#577)
This commit is contained in:
parent
c64c572235
commit
0638051e9a
122
examples.md
122
examples.md
@ -1,39 +1,44 @@
|
|||||||
# Examples
|
# Examples
|
||||||
|
|
||||||
- [Examples](#examples)
|
- [C# - NuGet](#c---nuget)
|
||||||
- [C# - NuGet](#c---nuget)
|
- [D - DUB](#d---dub)
|
||||||
- [D - DUB](#d---dub)
|
- [POSIX](#posix)
|
||||||
- [Elixir - Mix](#elixir---mix)
|
- [Windows](#windows)
|
||||||
- [Go - Modules](#go---modules)
|
- [Elixir - Mix](#elixir---mix)
|
||||||
- [Haskell - Cabal](#haskell---cabal)
|
- [Go - Modules](#go---modules)
|
||||||
- [Java - Gradle](#java---gradle)
|
- [Linux](#linux)
|
||||||
- [Java - Maven](#java---maven)
|
- [macOS](#macos)
|
||||||
- [Node - npm](#node---npm)
|
- [Windows](#windows-1)
|
||||||
- [macOS and Ubuntu](#macos-and-ubuntu)
|
- [Haskell - Cabal](#haskell---cabal)
|
||||||
- [Windows](#windows)
|
- [Java - Gradle](#java---gradle)
|
||||||
- [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config)
|
- [Java - Maven](#java---maven)
|
||||||
- [Node - Lerna](#node---lerna)
|
- [Node - npm](#node---npm)
|
||||||
- [Node - Yarn](#node---yarn)
|
- [macOS and Ubuntu](#macos-and-ubuntu)
|
||||||
- [Node - Yarn 2](#node---yarn-2)
|
- [Windows](#windows-2)
|
||||||
- [OCaml/Reason - esy](#ocamlreason---esy)
|
- [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config)
|
||||||
- [PHP - Composer](#php---composer)
|
- [Node - Lerna](#node---lerna)
|
||||||
- [Python - pip](#python---pip)
|
- [Node - Yarn](#node---yarn)
|
||||||
- [Simple example](#simple-example)
|
- [Node - Yarn 2](#node---yarn-2)
|
||||||
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow)
|
- [OCaml/Reason - esy](#ocamlreason---esy)
|
||||||
- [Using pip to get cache location](#using-pip-to-get-cache-location)
|
- [PHP - Composer](#php---composer)
|
||||||
- [Using a script to get cache location](#using-a-script-to-get-cache-location)
|
- [Python - pip](#python---pip)
|
||||||
- [Python - pipenv](#python---pipenv)
|
- [Simple example](#simple-example)
|
||||||
- [R - renv](#r---renv)
|
- [Multiple OS's in a workflow](#multiple-oss-in-a-workflow)
|
||||||
- [Simple example](#simple-example-1)
|
- [Multiple OS's in a workflow with a matrix](#multiple-oss-in-a-workflow-with-a-matrix)
|
||||||
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow-1)
|
- [Using pip to get cache location](#using-pip-to-get-cache-location)
|
||||||
- [Ruby - Bundler](#ruby---bundler)
|
- [Python - pipenv](#python---pipenv)
|
||||||
- [Rust - Cargo](#rust---cargo)
|
- [R - renv](#r---renv)
|
||||||
- [Scala - SBT](#scala---sbt)
|
- [Simple example](#simple-example-1)
|
||||||
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
|
- [Multiple OS's in a workflow](#multiple-oss-in-a-workflow-1)
|
||||||
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
- [Ruby - Bundler](#ruby---bundler)
|
||||||
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
- [Rust - Cargo](#rust---cargo)
|
||||||
|
- [Scala - SBT](#scala---sbt)
|
||||||
|
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
|
||||||
|
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
|
||||||
|
- [Swift - Swift Package Manager](#swift---swift-package-manager)
|
||||||
|
|
||||||
## C# - NuGet
|
## C# - NuGet
|
||||||
|
|
||||||
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -47,6 +52,7 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
|
|||||||
|
|
||||||
Depending on the environment, huge packages might be pre-installed in the global cache folder.
|
Depending on the environment, huge packages might be pre-installed in the global cache folder.
|
||||||
With `actions/cache@v2` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
|
With `actions/cache@v2` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
@ -111,10 +117,40 @@ steps:
|
|||||||
|
|
||||||
## Go - Modules
|
## Go - Modules
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
path: ~/go/pkg/mod
|
path: |
|
||||||
|
~/.cache/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
```
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/Library/Caches/go-build
|
||||||
|
~/go/pkg/mod
|
||||||
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-go-
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
%LocalAppData%\go-build
|
||||||
|
~/go/pkg/mod
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-go-
|
${{ runner.os }}-go-
|
||||||
@ -241,8 +277,8 @@ The yarn cache directory will depend on your operating system and version of `ya
|
|||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-yarn-
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Node - Yarn 2
|
## Node - Yarn 2
|
||||||
|
|
||||||
The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/configuration/yarnrc#cacheFolder for more info.
|
The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/configuration/yarnrc#cacheFolder for more info.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -260,6 +296,7 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c
|
|||||||
```
|
```
|
||||||
|
|
||||||
## OCaml/Reason - esy
|
## OCaml/Reason - esy
|
||||||
|
|
||||||
Esy allows you to export built dependencies and import pre-built dependencies.
|
Esy allows you to export built dependencies and import pre-built dependencies.
|
||||||
```yaml
|
```yaml
|
||||||
- name: Restore Cache
|
- name: Restore Cache
|
||||||
@ -286,7 +323,6 @@ Esy allows you to export built dependencies and import pre-built dependencies.
|
|||||||
if: steps.restore-cache.outputs.cache-hit != 'true'
|
if: steps.restore-cache.outputs.cache-hit != 'true'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## PHP - Composer
|
## PHP - Composer
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -307,11 +343,13 @@ Esy allows you to export built dependencies and import pre-built dependencies.
|
|||||||
For pip, the cache directory will vary by OS. See https://pip.pypa.io/en/stable/reference/pip_install/#caching
|
For pip, the cache directory will vary by OS. See https://pip.pypa.io/en/stable/reference/pip_install/#caching
|
||||||
|
|
||||||
Locations:
|
Locations:
|
||||||
- Ubuntu: `~/.cache/pip`
|
|
||||||
- Windows: `~\AppData\Local\pip\Cache`
|
- Ubuntu: `~/.cache/pip`
|
||||||
- macOS: `~/Library/Caches/pip`
|
- Windows: `~\AppData\Local\pip\Cache`
|
||||||
|
- macOS: `~/Library/Caches/pip`
|
||||||
|
|
||||||
### Simple example
|
### Simple example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
@ -410,11 +448,13 @@ jobs:
|
|||||||
For renv, the cache directory will vary by OS. Look at https://rstudio.github.io/renv/articles/renv.html#cache
|
For renv, the cache directory will vary by OS. Look at https://rstudio.github.io/renv/articles/renv.html#cache
|
||||||
|
|
||||||
Locations:
|
Locations:
|
||||||
- Ubuntu: `~/.local/share/renv`
|
|
||||||
- macOS: `~/Library/Application Support/renv`
|
- Ubuntu: `~/.local/share/renv`
|
||||||
- Windows: `%LOCALAPPDATA%/renv`
|
- macOS: `~/Library/Application Support/renv`
|
||||||
|
- Windows: `%LOCALAPPDATA%/renv`
|
||||||
|
|
||||||
### Simple example
|
### Simple example
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
Loading…
Reference in New Issue
Block a user