Skip to content

Commit eee8ff7

Browse files
authored
Fix go cache path per Github Action example, fix build for different go versions (#5331)
Signed-off-by: Bogdan Drutu <[email protected]>
1 parent b781f85 commit eee8ff7

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.github/workflows/build-and-test.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
uses: actions/cache@v3
2626
with:
2727
path: |
28-
/home/runner/go/bin
29-
/home/runner/go/pkg/mod
28+
~/go/bin
29+
~/go/pkg/mod
3030
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
3131
- name: Install dependencies
3232
if: steps.go-cache.outputs.cache-hit != 'true'
@@ -53,8 +53,8 @@ jobs:
5353
uses: actions/cache@v3
5454
with:
5555
path: |
56-
/home/runner/go/bin
57-
/home/runner/go/pkg/mod
56+
~/go/bin
57+
~/go/pkg/mod
5858
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
5959
- name: golint
6060
run: make -j2 golint
@@ -80,8 +80,8 @@ jobs:
8080
uses: actions/cache@v3
8181
with:
8282
path: |
83-
/home/runner/go/bin
84-
/home/runner/go/pkg/mod
83+
~/go/bin
84+
~/go/pkg/mod
8585
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
8686
- name: checklicense
8787
run: make checklicense
@@ -133,14 +133,14 @@ jobs:
133133
uses: actions/cache@v3
134134
with:
135135
path: |
136-
/home/runner/go/bin
137-
/home/runner/go/pkg/mod
136+
~/go/bin
137+
~/go/pkg/mod
138138
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
139139
- name: Cache Build
140140
uses: actions/cache@v3
141141
with:
142-
path: /home/runner/.cache/go-build
143-
key: go-build-unittest-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
142+
path: ~/.cache/go-build
143+
key: unittest-${{ runner.os }}-go-build-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
144144
- name: Run Unit Tests
145145
run: make gotest
146146
test-coverage:
@@ -162,14 +162,14 @@ jobs:
162162
uses: actions/cache@v3
163163
with:
164164
path: |
165-
/home/runner/go/bin
166-
/home/runner/go/pkg/mod
165+
~/go/bin
166+
~/go/pkg/mod
167167
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
168168
- name: Cache Build
169169
uses: actions/cache@v3
170170
with:
171-
path: /home/runner/.cache/go-build
172-
key: go-build-coverage-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
171+
path: ~/.cache/go-build
172+
key: coverage-${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
173173
- name: Run Unit Tests With Coverage
174174
run: make gotest-with-cover
175175
- name: Upload coverage report
@@ -221,8 +221,8 @@ jobs:
221221
uses: actions/cache@v3
222222
with:
223223
path: |
224-
/home/runner/go/bin
225-
/home/runner/go/pkg/mod
224+
~/go/bin
225+
~/go/pkg/mod
226226
key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }}
227227
- name: Build
228228
env:

0 commit comments

Comments
 (0)