File tree Expand file tree Collapse file tree 3 files changed +37
-10
lines changed Expand file tree Collapse file tree 3 files changed +37
-10
lines changed Original file line number Diff line number Diff line change 8
8
with :
9
9
cache : true
10
10
go-version : " 1.20.5"
11
+
12
+ - name : Cache go
13
+ uses : buildjet/cache@v3
14
+ with :
15
+ # ~/go/pkg is the same across operating systems.
16
+ path : |
17
+ ~/go/pkg
18
+ ~/.cache/go-build
19
+ ~/AppData/Local/go-build
20
+ ~/Library/Caches/go-build
21
+ # Job name must be included in the key for effective
22
+ # test cache reuse.
23
+ key : go-${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/*.go', 'go.**') }}
24
+ restore-keys : |
25
+ go-${{ runner.os }}-${{ github.job }}-
26
+ go-${{ runner.os }}-
27
+ go-
28
+
11
29
- name : Install gotestsum
12
30
uses : jaxxstorm/action-install-gh-release@v1.10.0
13
31
with :
14
32
repo : gotestyourself/gotestsum
15
33
tag : v1.9.0
34
+
35
+ # It isn't necessary that we ever do this, but it helps
36
+ # separate the "setup" from the "run" times.
37
+ - name : go mod download
38
+ shell : bash
39
+ run : go mod download -x
Original file line number Diff line number Diff line change @@ -218,8 +218,18 @@ jobs:
218
218
echo "cover=false" >> $GITHUB_OUTPUT
219
219
fi
220
220
221
+ # By default Go will use the number of logical CPUs, which
222
+ # is a fine default.
223
+ PARALLEL_FLAG=""
224
+ if [ "${{ matrix.os }}" == "windows-2019" ]; then
225
+ # Windows appears more I/O bound, so we increase parallelism
226
+ # to make better use of CPU.
227
+ PARALLEL_FLAG="-parallel=16"
228
+ fi
229
+
221
230
export TS_DEBUG_DISCO=true
222
- gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" --packages="./..." -- -parallel=8 -timeout=7m -short -failfast $COVERAGE_FLAGS
231
+ gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" \
232
+ --packages="./..." -- $PARALLEL_FLAG -short -failfast $COVERAGE_FLAGS
223
233
224
234
- name : Print test stats
225
235
if : success() || failure()
@@ -228,13 +238,6 @@ jobs:
228
238
# so we need to print the test stats to the log.
229
239
go run ./scripts/ci-report/main.go gotests.json | tee gotests_stats.json
230
240
231
- - uses : actions/upload-artifact@v3
232
- if : success() || failure()
233
- with :
234
- name : gotests-${{ matrix.os }}.xml
235
- path : ./gotests.xml
236
- retention-days : 30
237
-
238
241
- uses : ./.github/actions/upload-datadog
239
242
if : always()
240
243
with :
Original file line number Diff line number Diff line change @@ -610,15 +610,15 @@ test: test-clean
610
610
611
611
# When updating -timeout for this test, keep in sync with
612
612
# test-go-postgres (.github/workflows/coder.yaml).
613
+ # Do add coverage flags so that test caching works.
613
614
test-postgres : test-clean test-postgres-docker
614
615
# The postgres test is prone to failure, so we limit parallelism for
615
616
# more consistent execution.
616
617
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum \
617
618
--junitfile=" gotests.xml" \
618
619
--jsonfile=" gotests.json" \
619
620
--packages=" ./..." -- \
620
- -covermode=atomic -coverprofile=" gotests.coverage" -timeout=20m \
621
- -coverpkg=./... \
621
+ -timeout=20m \
622
622
-failfast
623
623
.PHONY : test-postgres
624
624
You can’t perform that action at this time.
0 commit comments