@@ -26,21 +26,14 @@ concurrency:
26
26
group :${{ github.workflow }}-${{ github.ref }}
27
27
cancel-in-progress :${{ github.event_name == 'pull_request' }}
28
28
29
- env :
30
- CODER_GO_VERSION :" ~1.20"
31
-
32
29
jobs :
33
30
lint :
34
31
runs-on :${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
35
32
steps :
36
33
-name :Checkout
37
34
uses :actions/checkout@v3
38
35
39
- # Install Go!
40
- -uses :buildjet/setup-go@v4
41
- with :
42
- go-version :${{ env.CODER_GO_VERSION }}
43
- cache :true
36
+ -uses :./.github/actions/setup-go
44
37
45
38
# Check for any typos!
46
39
-name :Check for typos
67
60
with :
68
61
ignore :node_modules
69
62
70
- # Lint our dashboard!
71
- -name :Cache node_modules
72
- id :cache-node
73
- uses :buildjet/cache@v3
74
- with :
75
- path :|
76
- **/node_modules
77
- .eslintcache
78
- key :js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
79
- restore-keys :|
80
- js-${{ runner.os }}-
81
- -name :Install node_modules
82
- run :./scripts/yarn_install.sh
63
+ -uses :./.github/actions/setup-node
83
64
-name :Lint TypeScript
84
65
run :yarn lint
85
66
working-directory :site
@@ -139,42 +120,8 @@ jobs:
139
120
steps :
140
121
-uses :actions/checkout@v3
141
122
142
- -name :Cache Node
143
- id :cache-node
144
- uses :buildjet/cache@v3
145
- with :
146
- path :|
147
- **/node_modules
148
- .eslintcache
149
- key :js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
150
- restore-keys :|
151
- js-${{ runner.os }}-
152
-
153
- -name :Install node_modules
154
- run :./scripts/yarn_install.sh
155
-
156
- -uses :buildjet/setup-go@v4
157
- with :
158
- cache :false
159
- go-version :${{ env.CODER_GO_VERSION }}
160
-
161
- -name :Echo Go Cache Paths
162
- id :go-cache-paths
163
- run :|
164
- echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
165
- echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
166
-
167
- -name :Go Build Cache
168
- uses :buildjet/cache@v3
169
- with :
170
- path :${{ steps.go-cache-paths.outputs.GOCACHE }}
171
- key :${{ github.job }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }}
172
-
173
- -name :Go Mod Cache
174
- uses :buildjet/cache@v3
175
- with :
176
- path :${{ steps.go-cache-paths.outputs.GOMODCACHE }}
177
- key :${{ github.job }}-go-mod-${{ hashFiles('**/go.sum') }}
123
+ -uses :./.github/actions/setup-node
124
+ -uses :./.github/actions/setup-go
178
125
179
126
-name :Install sqlc
180
127
run :|
@@ -219,19 +166,8 @@ jobs:
219
166
fetch-depth :0
220
167
submodules :true
221
168
222
- -name :Cache Node
223
- id :cache-node
224
- uses :buildjet/cache@v3
225
- with :
226
- path :|
227
- **/node_modules
228
- .eslintcache
229
- key :js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
230
- restore-keys :|
231
- js-${{ runner.os }}-
232
-
233
- -name :Install node_modules
234
- run :./scripts/yarn_install.sh
169
+ -uses :./.github/actions/setup-node
170
+ -uses :./.github/actions/setup-go
235
171
236
172
-name :Install shfmt
237
173
run :go install mvdan.cc/sh/v3/cmd/shfmt@v3.5.0
@@ -261,23 +197,7 @@ jobs:
261
197
cache :false
262
198
go-version :${{ env.CODER_GO_VERSION }}
263
199
264
- -name :Echo Go Cache Paths
265
- id :go-cache-paths
266
- run :|
267
- echo "GOCACHE=$(go env GOCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
268
- echo "GOMODCACHE=$(go env GOMODCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
269
-
270
- -name :Go Build Cache
271
- uses :buildjet/cache@v3
272
- with :
273
- path :${{ steps.go-cache-paths.outputs.GOCACHE }}
274
- key :${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}
275
-
276
- -name :Go Mod Cache
277
- uses :buildjet/cache@v3
278
- with :
279
- path :${{ steps.go-cache-paths.outputs.GOMODCACHE }}
280
- key :${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
200
+ -uses :./.github/actions/setup-go
281
201
282
202
-name :Install gotestsum
283
203
uses :jaxxstorm/action-install-gh-release@v1.10.0
@@ -335,7 +255,7 @@ jobs:
335
255
files :./gotests.coverage
336
256
flags :unittest-go-${{ matrix.os }}
337
257
338
- test-go-psql :
258
+ test-go-pg :
339
259
runs-on :${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
340
260
# This timeout must be greater than the timeout set by `go test` in
341
261
# `make test-postgres` to ensure we receive a trace of running
@@ -345,28 +265,7 @@ jobs:
345
265
steps :
346
266
-uses :actions/checkout@v3
347
267
348
- -uses :buildjet/setup-go@v4
349
- with :
350
- cache :false
351
- go-version :${{ env.CODER_GO_VERSION }}
352
-
353
- -name :Echo Go Cache Paths
354
- id :go-cache-paths
355
- run :|
356
- echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
357
- echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
358
-
359
- -name :Go Build Cache
360
- uses :buildjet/cache@v3
361
- with :
362
- path :${{ steps.go-cache-paths.outputs.GOCACHE }}
363
- key :${{ runner.os }}-go-build-${{ hashFiles('**/go.sum', '**/**.go') }}
364
-
365
- -name :Go Mod Cache
366
- uses :buildjet/cache@v3
367
- with :
368
- path :${{ steps.go-cache-paths.outputs.GOMODCACHE }}
369
- key :${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
268
+ -uses :./.github/actions/setup-go
370
269
371
270
-name :Install gotestsum
372
271
uses :jaxxstorm/action-install-gh-release@v1.10.0
@@ -412,6 +311,23 @@ jobs:
412
311
files :./gotests.coverage
413
312
flags :unittest-go-postgres-linux
414
313
314
+ test-go-race :
315
+ runs-on :${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
316
+ timeout-minutes :25
317
+ steps :
318
+ -uses :actions/checkout@v3
319
+
320
+ -uses :./.github/actions/setup-go
321
+
322
+ -uses :hashicorp/setup-terraform@v2
323
+ with :
324
+ terraform_version :1.1.9
325
+ terraform_wrapper :false
326
+
327
+ -name :Run Tests
328
+ run :|
329
+ go test -race ./...
330
+
415
331
deploy :
416
332
name :" deploy"
417
333
runs-on :${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
@@ -442,34 +358,8 @@ jobs:
442
358
cache :false
443
359
go-version :${{ env.CODER_GO_VERSION }}
444
360
445
- -name :Echo Go Cache Paths
446
- id :go-cache-paths
447
- run :|
448
- echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
449
- echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
450
-
451
- -name :Go Build Cache
452
- uses :buildjet/cache@v3
453
- with :
454
- path :${{ steps.go-cache-paths.outputs.GOCACHE }}
455
- key :${{ runner.os }}-release-go-build-${{ hashFiles('**/go.sum') }}
456
-
457
- -name :Go Mod Cache
458
- uses :buildjet/cache@v3
459
- with :
460
- path :${{ steps.go-cache-paths.outputs.GOMODCACHE }}
461
- key :${{ runner.os }}-release-go-mod-${{ hashFiles('**/go.sum') }}
462
-
463
- -name :Cache Node
464
- id :cache-node
465
- uses :buildjet/cache@v3
466
- with :
467
- path :|
468
- **/node_modules
469
- .eslintcache
470
- key :js-${{ runner.os }}-release-node-${{ hashFiles('**/yarn.lock') }}
471
- restore-keys :|
472
- js-${{ runner.os }}-
361
+ -uses :./.github/actions/setup-go
362
+ -uses :./.github/actions/setup-node
473
363
474
364
-name :Install goimports
475
365
run :go install golang.org/x/tools/cmd/goimports@latest
@@ -538,23 +428,7 @@ jobs:
538
428
steps :
539
429
-uses :actions/checkout@v3
540
430
541
- -name :Cache Node
542
- id :cache-node
543
- uses :buildjet/cache@v3
544
- with :
545
- path :|
546
- **/node_modules
547
- .eslintcache
548
- key :js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }}
549
- restore-keys :|
550
- js-${{ runner.os }}-
551
-
552
- -uses :buildjet/setup-node@v3
553
- with :
554
- node-version :" 16.16.0"
555
-
556
- -name :Install node_modules
557
- run :./scripts/yarn_install.sh
431
+ -uses :./.github/actions/setup-node
558
432
559
433
-run :yarn test:ci --max-workers ${{ steps.cpu-cores.outputs.count }}
560
434
working-directory :site
@@ -580,19 +454,8 @@ jobs:
580
454
steps :
581
455
-uses :actions/checkout@v3
582
456
583
- -name :Cache Node
584
- id :cache-node
585
- uses :buildjet/cache@v3
586
- with :
587
- path :|
588
- **/node_modules
589
- .eslintcache
590
- key :js-${{ runner.os }}-e2e-${{ hashFiles('**/yarn.lock') }}
591
-
592
- -uses :buildjet/setup-go@v4
593
- with :
594
- cache :false
595
- go-version :${{ env.CODER_GO_VERSION }}
457
+ -uses :./.github/actions/setup-node
458
+ -uses :./.github/actions/setup-go
596
459
597
460
-uses :hashicorp/setup-terraform@v2
598
461
with :
@@ -603,24 +466,6 @@ jobs:
603
466
with :
604
467
node-version :" 16.16.0"
605
468
606
- -name :Echo Go Cache Paths
607
- id :go-cache-paths
608
- run :|
609
- echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
610
- echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
611
-
612
- -name :Go Build Cache
613
- uses :buildjet/cache@v3
614
- with :
615
- path :${{ steps.go-cache-paths.outputs.GOCACHE }}
616
- key :${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
617
-
618
- -name :Go Mod Cache
619
- uses :buildjet/cache@v3
620
- with :
621
- path :${{ steps.go-cache-paths.outputs.GOMODCACHE }}
622
- key :${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
623
-
624
469
-name :Build
625
470
run :|
626
471
sudo npm install -g prettier
@@ -655,12 +500,7 @@ jobs:
655
500
# only get 1 commit on shallow checkout.
656
501
fetch-depth :0
657
502
658
- -uses :buildjet/setup-node@v3
659
- with :
660
- node-version :" 16.16.0"
661
-
662
- -name :Install dependencies
663
- run :cd site && yarn
503
+ -uses :./.github/actions/setup-node
664
504
665
505
# This step is not meant for mainline because any detected changes to
666
506
# storybook snapshots will require manual approval/review in order for