6
6
# Every day at 4AM
7
7
- cron : " 0 4 * * 1-5"
8
8
workflow_dispatch :
9
+ pull_request :
10
+ branches :
11
+ - main
9
12
10
13
permissions :
11
14
contents : read
12
15
13
16
jobs :
14
17
test-go-pg :
15
- runs-on : ${{ matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-16-cores' || matrix.os }}
16
- if : github.ref == 'refs/heads/main'
18
+ runs-on : ${{ matrix.os == 'macos-latest' && github.repository_owner == 'coder' && 'depot-macos-latest' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'depot-windows-2022-16' || matrix.os }}
17
19
# This timeout must be greater than the timeout set by `go test` in
18
20
# `make test-postgres` to ensure we receive a trace of running
19
21
# goroutines. Setting this to the timeout +5m should work quite well
@@ -31,22 +33,29 @@ jobs:
31
33
with :
32
34
egress-policy : audit
33
35
36
+ # Set up RAM disks to speed up the rest of the job. This action is in
37
+ # a separate repository to allow its use before actions/checkout.
38
+ - name : Setup RAM Disks
39
+ if : runner.os == 'Windows'
40
+ uses : coder/setup-ramdisk-action@79dacfe70c47ad6d6c0dd7f45412368802641439
41
+
34
42
- name : Checkout
35
43
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36
44
with :
37
45
fetch-depth : 1
38
46
39
47
- name : Setup Go
40
48
uses : ./.github/actions/setup-go
49
+ with :
50
+ # Runners have Go baked-in and Go will automatically
51
+ # download the toolchain configured in go.mod, so we don't
52
+ # need to reinstall it. It's faster on Windows runners.
53
+ use-preinstalled-go : ${{ runner.os == 'Windows' }}
54
+ use-temp-cache-dirs : ${{ runner.os == 'Windows' }}
41
55
42
56
- name : Setup Terraform
43
57
uses : ./.github/actions/setup-tf
44
58
45
- # Sets up the ImDisk toolkit for Windows and creates a RAM disk on drive R:.
46
- - name : Setup ImDisk
47
- if : runner.os == 'Windows'
48
- uses : ./.github/actions/setup-imdisk
49
-
50
59
- name : Test with PostgreSQL Database
51
60
env :
52
61
POSTGRES_VERSION : " 13"
@@ -81,10 +90,19 @@ jobs:
81
90
go run scripts/embedded-pg/main.go
82
91
fi
83
92
84
- # Reduce test parallelism, mirroring what we do for race tests.
85
- # We'd been encountering issues with timing related flakes, and
86
- # this seems to help.
87
- DB=ci gotestsum --format standard-quiet -- -v -short -count=1 -parallel 4 -p 4 ./...
93
+ NUM_PARALLEL_PACKAGES=16
94
+ NUM_PARALLEL_TESTS=16
95
+ if [ "${{ runner.os }}" == "Windows" ]; then
96
+ NUM_PARALLEL_PACKAGES=8
97
+ fi
98
+ if [ "${{ runner.os }}" == "macOS" ]; then
99
+ NUM_PARALLEL_TESTS=8
100
+ NUM_PARALLEL_PACKAGES=6
101
+ fi
102
+
103
+ DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=1000 \
104
+ --format standard-quiet --packages "./..." \
105
+ -- -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS -count=1
88
106
89
107
- name : Upload test stats to Datadog
90
108
timeout-minutes : 1
0 commit comments