@@ -5,17 +5,42 @@ inputs:
5
5
version :
6
6
description : " The Go version to use."
7
7
default : " 1.24.2"
8
+ use-preinstalled-go :
9
+ description : " Whether to use preinstalled Go."
10
+ default : " false"
11
+ use-temp-cache-dirs :
12
+ description : " Whether to use temporary GOCACHE and GOMODCACHE directories."
13
+ default : " false"
8
14
runs :
9
15
using : " composite"
10
16
steps :
17
+ - name : Override GOCACHE and GOMODCACHE
18
+ shell : bash
19
+ if : inputs.use-temp-cache-dirs == 'true'
20
+ run : |
21
+ # cd to another directory to ensure we're not inside a Go project.
22
+ # That'd trigger Go to download the toolchain for that project.
23
+ cd "$RUNNER_TEMP"
24
+ # RUNNER_TEMP should be backed by a RAM disk on Windows if
25
+ # coder/setup-ramdisk-action was used
26
+ export GOCACHE_DIR="$RUNNER_TEMP""\go-cache"
27
+ export GOMODCACHE_DIR="$RUNNER_TEMP""\go-mod-cache"
28
+ export GOPATH_DIR="$RUNNER_TEMP""\go-path"
29
+ mkdir -p "$GOCACHE_DIR"
30
+ mkdir -p "$GOMODCACHE_DIR"
31
+ mkdir -p "$GOPATH_DIR"
32
+ go env -w GOCACHE="$GOCACHE_DIR"
33
+ go env -w GOMODCACHE="$GOMODCACHE_DIR"
34
+ go env -w GOPATH="$GOPATH_DIR"
35
+
11
36
- name : Setup Go
12
37
uses : actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
13
38
with :
14
- go-version : ${{ inputs.version }}
39
+ go-version : ${{ inputs.use-preinstalled-go == 'false' && inputs. version || '' }}
15
40
16
41
- name : Install gotestsum
17
42
shell : bash
18
- run : go install gotest.tools/gotestsum@latest
43
+ run : go install gotest.tools/gotestsum@3f7ff0ec4aeb6f95f5d67c998b71f272aa8a8b41 # v1.12.1
19
44
20
45
# It isn't necessary that we ever do this, but it helps
21
46
# separate the "setup" from the "run" times.
0 commit comments