@@ -46,14 +46,30 @@ jobs:
46
46
include :
47
47
- goarch : amd64
48
48
- goarch : amd64
49
- variant : race
49
+ buildflags : " - race"
50
50
- goarch : " 386" # thanks yaml
51
51
runs-on : ubuntu-22.04
52
52
steps :
53
53
- name : checkout
54
54
uses : actions/checkout@v3
55
+ - name : Restore Cache
56
+ uses : actions/cache@v3
57
+ with :
58
+ # Note: unlike the other setups, this is only grabbing the mod download
59
+ # cache, rather than the whole mod directory, as the download cache
60
+ # contains zips that can be unpacked in parallel faster than they can be
61
+ # fetched and extracted by tar
62
+ path : |
63
+ ~/.cache/go-build
64
+ ~/go/pkg/mod/cache
65
+ ~\AppData\Local\go-build
66
+ # The -2- here should be incremented when the scheme of data to be
67
+ # cached changes (e.g. path above changes).
68
+ key : ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-${{ hashFiles('**/go.sum') }}
69
+ restore-keys : |
70
+ ${{ github.job }}-${{ runner.os }}-${{ matrix.goarch }}-${{ matrix.buildflags }}-go-2-
55
71
- name : build all
56
- run : ./tool/go build ./...
72
+ run : ./tool/go build ${{matrix.buildflags}} ./...
57
73
env :
58
74
GOARCH : ${{ matrix.goarch }}
59
75
- name : build variant CLIs
73
89
- name : build test wrapper
74
90
run : ./tool/go build -o /tmp/testwrapper ./cmd/testwrapper
75
91
- name : test all
76
- if : matrix.variant != 'race'
77
- run : ./tool/go test -exec=/tmp/testwrapper -bench=. -benchtime=1x ./...
78
- env :
79
- GOARCH : ${{ matrix.goarch }}
80
- - name : test all (race)
81
- if : matrix.variant == 'race'
82
- run : ./tool/go test -race -exec=/tmp/testwrapper -bench=. -benchtime=1x ./...
92
+ run : ./tool/go test ${{matrix.buildflags}} -exec=/tmp/testwrapper -bench=. -benchtime=1x ./...
83
93
env :
84
94
GOARCH : ${{ matrix.goarch }}
85
95
- name : check that no tracked files changed
@@ -116,12 +126,14 @@ jobs:
116
126
# contains zips that can be unpacked in parallel faster than they can be
117
127
# fetched and extracted by tar
118
128
path : |
129
+ ~/.cache/go-build
119
130
~/go/pkg/mod/cache
120
131
~\AppData\Local\go-build
121
132
# The -2- here should be incremented when the scheme of data to be
122
133
# cached changes (e.g. path above changes).
123
- # TODO(raggi): add a go version here.
124
- key : ${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
134
+ key : ${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
135
+ restore-keys : |
136
+ ${{ github.job }}-${{ runner.os }}-go-2-
125
137
- name : test
126
138
# Don't use -bench=. -benchtime=1x.
127
139
# Somewhere in the layers (powershell?)
@@ -181,6 +193,22 @@ jobs:
181
193
steps :
182
194
- name : checkout
183
195
uses : actions/checkout@v3
196
+ - name : Restore Cache
197
+ uses : actions/cache@v3
198
+ with :
199
+ # Note: unlike the other setups, this is only grabbing the mod download
200
+ # cache, rather than the whole mod directory, as the download cache
201
+ # contains zips that can be unpacked in parallel faster than they can be
202
+ # fetched and extracted by tar
203
+ path : |
204
+ ~/.cache/go-build
205
+ ~/go/pkg/mod/cache
206
+ ~\AppData\Local\go-build
207
+ # The -2- here should be incremented when the scheme of data to be
208
+ # cached changes (e.g. path above changes).
209
+ key : ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-${{ hashFiles('**/go.sum') }}
210
+ restore-keys : |
211
+ ${{ github.job }}-${{ runner.os }}-${{ matrix.goos }}-${{ matrix.goarch }}-go-2-
184
212
- name : build all
185
213
run : ./tool/go build ./cmd/...
186
214
env :
@@ -230,6 +258,22 @@ jobs:
230
258
steps :
231
259
- name : checkout
232
260
uses : actions/checkout@v3
261
+ - name : Restore Cache
262
+ uses : actions/cache@v3
263
+ with :
264
+ # Note: unlike the other setups, this is only grabbing the mod download
265
+ # cache, rather than the whole mod directory, as the download cache
266
+ # contains zips that can be unpacked in parallel faster than they can be
267
+ # fetched and extracted by tar
268
+ path : |
269
+ ~/.cache/go-build
270
+ ~/go/pkg/mod/cache
271
+ ~\AppData\Local\go-build
272
+ # The -2- here should be incremented when the scheme of data to be
273
+ # cached changes (e.g. path above changes).
274
+ key : ${{ github.job }}-${{ runner.os }}-go-2-${{ hashFiles('**/go.sum') }}
275
+ restore-keys : |
276
+ ${{ github.job }}-${{ runner.os }}-go-2-
233
277
- name : build tsconnect client
234
278
run : ./tool/go build ./cmd/tsconnect/wasm ./cmd/tailscale/cli
235
279
env :
0 commit comments