forked from WillAbides/setup-go-faster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
83 lines (75 loc) · 4.35 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: 'Setup Go Faster'
description: It's like actions/setup-go but faster.
inputs:
go-version:
required: false
description: |
The version of go to install. It can be an exact version or a semver constraint like '1.14.x' or '^1.14.4'.
Do not add "go" or "v" to the beginning of the version.
Action runners come with some versions of go pre-installed. If any of those versions meet your semver constraint
setup-go-faster will use those instead of checking whether a newer go available for download that meets your
constraint. You can change this with the `ignore-local` input below.
A special case value for go-version is `tip` which causes setup-go-faster to install the gotip from source. Be
warned there is nothing fast about this. It takes between 3 and 5 minutes on Ubuntu runners and is even slower
on Windows and MacOS runners.
Go versions aren't really semvers, but they are close enough to use semver constraints for the most part.
There are a some gotchas to watch out for:
- Prior to go1.21, Go doesn't release .0 versions. The first 1.15.x release is 1.15, not 1.15.0. This means if you
have set go-version to 1.15, when 1.15.1 is released it won't be used because 1.15 is an exact match. If you
want any go in the 1.15 family, set go-version to `1.15.x`. For consistency, setup-go-faster@v1 continues to
handle constraints for post 1.21 the same as pre 1.21. This may change in a future major version.
- Go's pre-releases are not valid semver. For example the beta for 1.16 is 1.16beta1. This means pre-releases
need to be explicitely specified.
For those who learn best from examples:
| go-version | description |
|--------------------|------------------------------------------------------------------------------------------------|
| 1.15.6 | installs 1.15.6 |
| 1.15beta1 | installs 1.15beta1 |
| 1.15.x | installs the newest go that starts with 1.15 |
| 1.15 | installs go 1.15, nothing newer. You generally do not want this and should use 1.15.x instead. |
| * | installs the newest go without any other constraints |
| ^1.15.4 | installs a go that is >= 1.15.4 and < 2 |
| ~1.15.4 | installs a go that is >= 1.15.4 and < 1.16 |
| < 1.15.6 >= 1.15.4 | installs a go that is >= 1.15.4 and < 1.15.6 |
| tip | installs gotip from source |
go-version-file:
required: false
description: 'Path to the go.mod or go.work file.'
ignore-local:
required: false
description: |
Normally a pre-installed version of go that meets the go-version constraints will be used instead
of checking whether a newer version is available for download. With ignore-local, the
action will always check for a newer version available for download. Set this to any non-empty value
to enable.
outputs:
GOCACHE:
description: output of `go env GOCACHE`
value: ${{ steps.run.outputs.GOCACHE }}
GOMODCACHE:
description: output of `go env GOMODCACHE`
value: ${{ steps.run.outputs.GOMODCACHE }}
GOPATH:
description: output of `go env GOPATH`
value: ${{ steps.run.outputs.GOPATH }}
GOROOT:
description: output of `go env GOROOT`
value: ${{ steps.run.outputs.GOROOT }}
GOTOOLDIR:
description: output of `go env GOTOOLDIR`
value: ${{ steps.run.outputs.GOTOOLDIR }}
runs:
using: composite
steps:
- id: run
working-directory: ${{ github.action_path }}
env:
DEBUG: ""
IGNORE_LOCAL_GO: ${{ inputs.ignore-local }}
GO_VERSION: ${{ inputs.go-version }}
GO_VERSION_FILE: ${{ inputs.go-version-file }}
shell: bash
run: src/run
branding:
color: green
icon: play-circle