Skip to content

Commit 0638051

Browse files
Golang example tweak - add go-build path - rebuild page TOC (#577)
1 parent c64c572 commit 0638051

File tree

1 file changed

+84
-44
lines changed

1 file changed

+84
-44
lines changed

examples.md

+84-44
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
# Examples
22

3-
- [Examples](#examples)
4-
- [C# - NuGet](#c---nuget)
5-
- [D - DUB](#d---dub)
6-
- [Elixir - Mix](#elixir---mix)
7-
- [Go - Modules](#go---modules)
8-
- [Haskell - Cabal](#haskell---cabal)
9-
- [Java - Gradle](#java---gradle)
10-
- [Java - Maven](#java---maven)
11-
- [Node - npm](#node---npm)
12-
- [macOS and Ubuntu](#macos-and-ubuntu)
13-
- [Windows](#windows)
14-
- [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config)
15-
- [Node - Lerna](#node---lerna)
16-
- [Node - Yarn](#node---yarn)
17-
- [Node - Yarn 2](#node---yarn-2)
18-
- [OCaml/Reason - esy](#ocamlreason---esy)
19-
- [PHP - Composer](#php---composer)
20-
- [Python - pip](#python---pip)
21-
- [Simple example](#simple-example)
22-
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow)
23-
- [Using pip to get cache location](#using-pip-to-get-cache-location)
24-
- [Using a script to get cache location](#using-a-script-to-get-cache-location)
25-
- [Python - pipenv](#python---pipenv)
26-
- [R - renv](#r---renv)
27-
- [Simple example](#simple-example-1)
28-
- [Multiple OSes in a workflow](#multiple-oss-in-a-workflow-1)
29-
- [Ruby - Bundler](#ruby---bundler)
30-
- [Rust - Cargo](#rust---cargo)
31-
- [Scala - SBT](#scala---sbt)
32-
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
33-
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
34-
- [Swift - Swift Package Manager](#swift---swift-package-manager)
3+
- [C# - NuGet](#c---nuget)
4+
- [D - DUB](#d---dub)
5+
- [POSIX](#posix)
6+
- [Windows](#windows)
7+
- [Elixir - Mix](#elixir---mix)
8+
- [Go - Modules](#go---modules)
9+
- [Linux](#linux)
10+
- [macOS](#macos)
11+
- [Windows](#windows-1)
12+
- [Haskell - Cabal](#haskell---cabal)
13+
- [Java - Gradle](#java---gradle)
14+
- [Java - Maven](#java---maven)
15+
- [Node - npm](#node---npm)
16+
- [macOS and Ubuntu](#macos-and-ubuntu)
17+
- [Windows](#windows-2)
18+
- [Using multiple systems and `npm config`](#using-multiple-systems-and-npm-config)
19+
- [Node - Lerna](#node---lerna)
20+
- [Node - Yarn](#node---yarn)
21+
- [Node - Yarn 2](#node---yarn-2)
22+
- [OCaml/Reason - esy](#ocamlreason---esy)
23+
- [PHP - Composer](#php---composer)
24+
- [Python - pip](#python---pip)
25+
- [Simple example](#simple-example)
26+
- [Multiple OS's in a workflow](#multiple-oss-in-a-workflow)
27+
- [Multiple OS's in a workflow with a matrix](#multiple-oss-in-a-workflow-with-a-matrix)
28+
- [Using pip to get cache location](#using-pip-to-get-cache-location)
29+
- [Python - pipenv](#python---pipenv)
30+
- [R - renv](#r---renv)
31+
- [Simple example](#simple-example-1)
32+
- [Multiple OS's in a workflow](#multiple-oss-in-a-workflow-1)
33+
- [Ruby - Bundler](#ruby---bundler)
34+
- [Rust - Cargo](#rust---cargo)
35+
- [Scala - SBT](#scala---sbt)
36+
- [Swift, Objective-C - Carthage](#swift-objective-c---carthage)
37+
- [Swift, Objective-C - CocoaPods](#swift-objective-c---cocoapods)
38+
- [Swift - Swift Package Manager](#swift---swift-package-manager)
3539

3640
## C# - NuGet
41+
3742
Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies):
3843

3944
```yaml
@@ -47,10 +52,11 @@ Using [NuGet lock files](https://docs.microsoft.com/nuget/consume-packages/packa
4752
4853
Depending on the environment, huge packages might be pre-installed in the global cache folder.
4954
With `actions/cache@v2` you can now exclude unwanted packages with [exclude pattern](https://github.com/actions/toolkit/tree/main/packages/glob#exclude-patterns)
55+
5056
```yaml
5157
- uses: actions/cache@v2
5258
with:
53-
path: |
59+
path: |
5460
~/.nuget/packages
5561
!~/.nuget/packages/unwanted
5662
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -111,10 +117,40 @@ steps:
111117

112118
## Go - Modules
113119

120+
### Linux
121+
122+
```yaml
123+
- uses: actions/cache@v2
124+
with:
125+
path: |
126+
~/.cache/go-build
127+
~/go/pkg/mod
128+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
129+
restore-keys: |
130+
${{ runner.os }}-go-
131+
```
132+
133+
### macOS
134+
114135
```yaml
115136
- uses: actions/cache@v2
116137
with:
117-
path: ~/go/pkg/mod
138+
path: |
139+
~/Library/Caches/go-build
140+
~/go/pkg/mod
141+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
142+
restore-keys: |
143+
${{ runner.os }}-go-
144+
```
145+
146+
### Windows
147+
148+
```yaml
149+
- uses: actions/cache@v2
150+
with:
151+
path: |
152+
%LocalAppData%\go-build
153+
~/go/pkg/mod
118154
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
119155
restore-keys: |
120156
${{ runner.os }}-go-
@@ -241,8 +277,8 @@ The yarn cache directory will depend on your operating system and version of `ya
241277
${{ runner.os }}-yarn-
242278
```
243279
244-
245280
## Node - Yarn 2
281+
246282
The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/configuration/yarnrc#cacheFolder for more info.
247283
248284
```yaml
@@ -260,6 +296,7 @@ The yarn 2 cache directory will depend on your config. See https://yarnpkg.com/c
260296
```
261297
262298
## OCaml/Reason - esy
299+
263300
Esy allows you to export built dependencies and import pre-built dependencies.
264301
```yaml
265302
- name: Restore Cache
@@ -280,13 +317,12 @@ Esy allows you to export built dependencies and import pre-built dependencies.
280317
...(Build job)...
281318

282319
# Re-export dependencies if anything has changed or if it is the first time
283-
- name: Setting dependency cache
320+
- name: Setting dependency cache
284321
run: |
285322
esy export-dependencies
286323
if: steps.restore-cache.outputs.cache-hit != 'true'
287324
```
288325
289-
290326
## PHP - Composer
291327
292328
```yaml
@@ -307,11 +343,13 @@ Esy allows you to export built dependencies and import pre-built dependencies.
307343
For pip, the cache directory will vary by OS. See https://pip.pypa.io/en/stable/reference/pip_install/#caching
308344
309345
Locations:
310-
- Ubuntu: `~/.cache/pip`
311-
- Windows: `~\AppData\Local\pip\Cache`
312-
- macOS: `~/Library/Caches/pip`
346+
347+
- Ubuntu: `~/.cache/pip`
348+
- Windows: `~\AppData\Local\pip\Cache`
349+
- macOS: `~/Library/Caches/pip`
313350

314351
### Simple example
352+
315353
```yaml
316354
- uses: actions/cache@v2
317355
with:
@@ -410,11 +448,13 @@ jobs:
410448
For renv, the cache directory will vary by OS. Look at https://rstudio.github.io/renv/articles/renv.html#cache
411449

412450
Locations:
413-
- Ubuntu: `~/.local/share/renv`
414-
- macOS: `~/Library/Application Support/renv`
415-
- Windows: `%LOCALAPPDATA%/renv`
451+
452+
- Ubuntu: `~/.local/share/renv`
453+
- macOS: `~/Library/Application Support/renv`
454+
- Windows: `%LOCALAPPDATA%/renv`
416455

417456
### Simple example
457+
418458
```yaml
419459
- uses: actions/cache@v2
420460
with:
@@ -490,7 +530,7 @@ whenever possible:
490530
- name: Cache SBT
491531
uses: actions/cache@v2
492532
with:
493-
path: |
533+
path: |
494534
~/.ivy2/cache
495535
~/.sbt
496536
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}

0 commit comments

Comments
 (0)