66 # Every day at 4AM
77 - cron : " 0 4 * * 1-5"
88 workflow_dispatch :
9+ pull_request :
10+ branches :
11+ - main
912
1013permissions :
1114 contents : read
1215
1316jobs :
1417 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 }}
1719 # This timeout must be greater than the timeout set by `go test` in
1820 # `make test-postgres` to ensure we receive a trace of running
1921 # goroutines. Setting this to the timeout +5m should work quite well
@@ -31,22 +33,29 @@ jobs:
3133 with :
3234 egress-policy : audit
3335
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+
3442 - name : Checkout
3543 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3644 with :
3745 fetch-depth : 1
3846
3947 - name : Setup Go
4048 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' }}
4155
4256 - name : Setup Terraform
4357 uses : ./.github/actions/setup-tf
4458
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-
5059 - name : Test with PostgreSQL Database
5160 env :
5261 POSTGRES_VERSION : " 13"
@@ -81,10 +90,19 @@ jobs:
8190 go run scripts/embedded-pg/main.go
8291 fi
8392
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
88106
89107 - name : Upload test stats to Datadog
90108 timeout-minutes : 1
0 commit comments