@@ -33,38 +33,31 @@ jobs:
3333 - name : " Fetch source code"
3434 uses : actions/checkout@v2
3535
36- # For our Go tests in particular we use goenv to make sure we're always
37- # using the same Go version we'd use for releases, as recorded in the
38- # .go-version file.
3936 - name : " Install Go"
4037 id : go
41- run : |
42- git clone https://github.com/syndbg/goenv.git ~/.goenv
43- ~/.goenv/bin/goenv install
44- ~/.goenv/bin/goenv rehash
45- echo "::set-output name=go-version::$(~/.goenv/bin/goenv version-name)"
38+ uses : ./.github/actions/go-setup
4639
47- # Note: this cache is shared with the " e2e-tests" job, so must always
48- # have identical configuration its corresponding step .
40+ # NOTE: This cache is shared with the e2e-tests job, so the corresponding
41+ # step in that job must always be identical to this one .
4942 - name : Cache Go modules
5043 uses : actions/cache@v3
5144 with :
52- path : " ~/go/ ${{steps.go.outputs.go-version }}/pkg"
45+ path : " ${{steps.go.outputs.gopath }}/pkg"
5346 key : go-mod-${{ hashFiles('go.sum') }}
5447 restore-keys : |
5548 go-mod-
5649
5750 - name : " go.mod and go.sum consistency check"
5851 run : |
59- ~/.goenv/shims/go mod tidy
52+ "${{steps.go.outputs.go}}" mod tidy
6053 if [[ -n "$(git status --porcelain)" ]]; then
6154 echo "go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files."
6255 exit 1
6356 fi
6457
6558 - name : " Unit tests"
6659 run : |
67- ~/.goenv/shims/go test ./...
60+ "${{steps.go.outputs.go}}" test ./...
6861
6962 # We'll also deal with some general consistency/lint/style checks
7063 # here just because they are relatively fast and so not worth running
7568 # We do need to fully init goenv in this one case because we're
7669 # going to run Go indirectly via make and some shell scripts, so
7770 # we need PATH set up correctly.
78- export PATH=~/. goenv/ bin:$PATH
71+ export PATH="${{steps.go.outputs. goenv- bin-dir}}" :$PATH
7972 eval "$(goenv init -)"
8073 go version
8174 make fmtcheck generate staticcheck exhaustive protobuf
@@ -97,27 +90,20 @@ jobs:
9790 - name : " Fetch source code"
9891 uses : actions/checkout@v2
9992
100- # For our Go tests in particular we use goenv to make sure we're always
101- # using the same Go version we'd use for releases, as recorded in the
102- # .go-version file.
10393 - name : " Install Go"
10494 id : go
105- run : |
106- git clone https://github.com/syndbg/goenv.git ~/.goenv
107- ~/.goenv/bin/goenv install
108- ~/.goenv/bin/goenv rehash
109- echo "::set-output name=go-version::$(~/.goenv/bin/goenv version-name)"
95+ uses : ./.github/actions/go-setup
11096
111- # Note: this cache is shared with the "unit -tests" job, so must always
112- # have identical configuration its corresponding step .
97+ # NOTE: This cache is shared with the e2e -tests job, so the corresponding
98+ # step in that job must always be identical to this one .
11399 - name : Cache Go modules
114100 uses : actions/cache@v3
115101 with :
116- path : " ~/go/ ${{steps.go.outputs.go-version }}/pkg"
102+ path : " ${{steps.go.outputs.gopath }}/pkg"
117103 key : go-mod-${{ hashFiles('go.sum') }}
118104 restore-keys : |
119105 go-mod-
120106
121107 - name : " End-to-end tests"
122108 run : |
123- TF_ACC=1 ~/.goenv/shims/go test -v ./internal/command/e2etest
109+ TF_ACC=1 "${{steps.go.outputs.go}}" test -v ./internal/command/e2etest
0 commit comments