@@ -11,14 +11,27 @@ permissions:
11
11
contents : read
12
12
13
13
jobs :
14
- go-race :
15
- # While GitHub's toaster runners are likelier to flake, we want consistency
16
- # between this environment and the regular test environment for DataDog
17
- # statistics and to only show real workflow threats.
18
- runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
19
- # This runner costs 0.016 USD per minute,
20
- # so 0.016 * 240 = 3.84 USD per run.
21
- timeout-minutes : 240
14
+ 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
+
17
+
18
+ # TODO: re-enable main check!
19
+
20
+
21
+
22
+
23
+
24
+ # if: github.ref == 'refs/heads/main'
25
+ # This timeout must be greater than the timeout set by `go test` in
26
+ # `make test-postgres` to ensure we receive a trace of running
27
+ # goroutines. Setting this to the timeout +5m should work quite well
28
+ # even if some of the preceding steps are slow.
29
+ timeout-minutes : 25
30
+ strategy :
31
+ matrix :
32
+ os :
33
+ - macos-latest
34
+ - windows-2022
22
35
steps :
23
36
- name : Harden Runner
24
37
uses : step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
@@ -27,56 +40,70 @@ jobs:
27
40
28
41
- name : Checkout
29
42
uses : actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
43
+ with :
44
+ fetch-depth : 1
30
45
31
46
- name : Setup Go
32
47
uses : ./.github/actions/setup-go
33
48
34
49
- name : Setup Terraform
35
50
uses : ./.github/actions/setup-tf
36
51
37
- - name : Run Tests
38
- run : |
39
- # -race is likeliest to catch flaky tests
40
- # due to correctness detection and its performance
41
- # impact.
42
- gotestsum --junitfile="gotests.xml" -- -timeout=240m -count=3 -race ./...
52
+ # Sets up the ImDisk toolkit for Windows and creates a RAM disk on drive R:.
53
+ - name : Setup ImDisk
54
+ if : runner.os == 'Windows'
55
+ uses : ./.github/actions/setup-imdisk
43
56
44
- - name : Upload test results to DataDog
45
- uses : ./.github/actions/upload-datadog
46
- if : always()
47
- with :
48
- api-key : ${{ secrets.DATADOG_API_KEY }}
57
+ - name : Test with PostgreSQL Database
58
+ env :
59
+ POSTGRES_VERSION : " 13"
60
+ TS_DEBUG_DISCO : " true"
61
+ LC_CTYPE : " en_US.UTF-8"
62
+ LC_ALL : " en_US.UTF-8"
63
+ shell : bash
64
+ run : |
65
+ # if macOS, install google-chrome for scaletests
66
+ # As another concern, should we really have this kind of external dependency
67
+ # requirement on standard CI?
68
+ if [ "${{ matrix.os }}" == "macos-latest" ]; then
69
+ brew install google-chrome
70
+ fi
49
71
50
- go-timing :
51
- # We run these tests with p=1 so we don't need a lot of compute.
52
- runs-on : ${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04' || 'ubuntu-latest' }}
53
- timeout-minutes : 10
54
- steps :
55
- - name : Harden Runner
56
- uses : step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
57
- with :
58
- egress-policy : audit
72
+ # By default Go will use the number of logical CPUs, which
73
+ # is a fine default.
74
+ PARALLEL_FLAG=""
59
75
60
- - name : Checkout
61
- uses : actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
76
+ # macOS will output "The default interactive shell is now zsh"
77
+ # intermittently in CI...
78
+ if [ "${{ matrix.os }}" == "macos-latest" ]; then
79
+ touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
80
+ fi
62
81
63
- - name : Setup Go
64
- uses : ./.github/actions/setup-go
82
+ if [ "${{ runner.os }}" == "Windows" ]; then
83
+ # Create a temp dir on the R: ramdisk drive for Windows. The default
84
+ # C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
85
+ mkdir -p "R:/temp/embedded-pg"
86
+ go run scripts/embedded-pg/main.go -path "R:/temp/embedded-pg"
87
+ # Reduce test parallelism, mirroring what we do for race tests.
88
+ # We'd been encountering issues with timing related flakes, and
89
+ # this seems to help.
90
+ else
91
+ go run scripts/embedded-pg/main.go
92
+ fi
65
93
66
- - name : Run Tests
67
- run : |
68
- gotestsum --junitfile="gotests.xml" -- --tags="timing" -p=1 -run='_Timing/' ./...
94
+ DB=ci gotestsum --format standard-quiet -- -v -short -count=1 -parallel 4 -p 4 ./...
69
95
70
- - name : Upload test results to DataDog
96
+ - name : Upload test stats to Datadog
97
+ timeout-minutes : 1
98
+ continue-on-error : true
71
99
uses : ./.github/actions/upload-datadog
72
- if : always ()
100
+ if : success() || failure ()
73
101
with :
74
102
api-key : ${{ secrets.DATADOG_API_KEY }}
75
103
76
104
notify-slack-on-failure :
77
105
needs :
78
- - go-race
79
- - go-timing
106
+ - test-go-pg
80
107
runs-on : ubuntu-latest
81
108
if : failure() && github.ref == 'refs/heads/main'
82
109
0 commit comments