Skip to content

Commit 9435514

Browse files
committed
revert to previous nightly gauntlet
1 parent 7be75c4 commit 9435514

File tree

1 file changed

+183
-0
lines changed

1 file changed

+183
-0
lines changed
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# The nightly-gauntlet runs tests that are either too flaky or too slow to block
2+
# every PR.
3+
name: nightly-gauntlet
4+
on:
5+
schedule:
6+
# Every day at 4AM
7+
- cron: "0 4 * * 1-5"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
test-go-pg:
15+
# make sure to adjust NUM_PARALLEL_PACKAGES and NUM_PARALLEL_TESTS below
16+
# when changing runner sizes
17+
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 }}
18+
# This timeout must be greater than the timeout set by `go test` in
19+
# `make test-postgres` to ensure we receive a trace of running
20+
# goroutines. Setting this to the timeout +5m should work quite well
21+
# even if some of the preceding steps are slow.
22+
timeout-minutes: 25
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
os:
27+
- macos-latest
28+
- windows-2022
29+
steps:
30+
- name: Harden Runner
31+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
32+
with:
33+
egress-policy: audit
34+
35+
# macOS indexes all new files in the background. Our Postgres tests
36+
# create and destroy thousands of databases on disk, and Spotlight
37+
# tries to index all of them, seriously slowing down the tests.
38+
- name: Disable Spotlight Indexing
39+
if: runner.os == 'macOS'
40+
run: |
41+
sudo mdutil -a -i off
42+
sudo mdutil -X /
43+
sudo launchctl bootout system /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
44+
45+
# Set up RAM disks to speed up the rest of the job. This action is in
46+
# a separate repository to allow its use before actions/checkout.
47+
- name: Setup RAM Disks
48+
if: runner.os == 'Windows'
49+
uses: coder/setup-ramdisk-action@79dacfe70c47ad6d6c0dd7f45412368802641439
50+
51+
- name: Checkout
52+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
53+
with:
54+
fetch-depth: 1
55+
56+
- name: Setup Go
57+
uses: ./.github/actions/setup-go
58+
with:
59+
# Runners have Go baked-in and Go will automatically
60+
# download the toolchain configured in go.mod, so we don't
61+
# need to reinstall it. It's faster on Windows runners.
62+
use-preinstalled-go: ${{ runner.os == 'Windows' }}
63+
use-temp-cache-dirs: ${{ runner.os == 'Windows' }}
64+
65+
- name: Setup Terraform
66+
uses: ./.github/actions/setup-tf
67+
68+
- name: Test with PostgreSQL Database
69+
env:
70+
POSTGRES_VERSION: "13"
71+
TS_DEBUG_DISCO: "true"
72+
LC_CTYPE: "en_US.UTF-8"
73+
LC_ALL: "en_US.UTF-8"
74+
shell: bash
75+
run: |
76+
if [ "${{ runner.os }}" == "Windows" ]; then
77+
# Create a temp dir on the R: ramdisk drive for Windows. The default
78+
# C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
79+
mkdir -p "R:/temp/embedded-pg"
80+
go run scripts/embedded-pg/main.go -path "R:/temp/embedded-pg"
81+
fi
82+
if [ "${{ runner.os }}" == "macOS" ]; then
83+
# Postgres runs faster on a ramdisk on macOS too
84+
mkdir -p /tmp/tmpfs
85+
sudo mount_tmpfs -o noowners -s 8g /tmp/tmpfs
86+
go run scripts/embedded-pg/main.go -path /tmp/tmpfs/embedded-pg
87+
fi
88+
89+
# if macOS, install google-chrome for scaletests
90+
# As another concern, should we really have this kind of external dependency
91+
# requirement on standard CI?
92+
if [ "${{ matrix.os }}" == "macos-latest" ]; then
93+
brew install google-chrome
94+
fi
95+
96+
# By default Go will use the number of logical CPUs, which
97+
# is a fine default.
98+
PARALLEL_FLAG=""
99+
100+
# macOS will output "The default interactive shell is now zsh"
101+
# intermittently in CI...
102+
if [ "${{ matrix.os }}" == "macos-latest" ]; then
103+
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
104+
fi
105+
106+
# Golang's default for these 2 variables is the number of logical CPUs.
107+
# Our Windows and Linux runners have 16 cores, so they match up there.
108+
NUM_PARALLEL_PACKAGES=16
109+
NUM_PARALLEL_TESTS=16
110+
if [ "${{ runner.os }}" == "Windows" ]; then
111+
# On Windows Postgres chokes up when we have 16x16=256 tests
112+
# running in parallel, and dbtestutil.NewDB starts to take more than
113+
# 10s to complete sometimes causing test timeouts. With 16x8=128 tests
114+
# Postgres tends not to choke.
115+
NUM_PARALLEL_PACKAGES=8
116+
fi
117+
if [ "${{ runner.os }}" == "macOS" ]; then
118+
# Our macOS runners have 8 cores. We leave NUM_PARALLEL_TESTS at 16
119+
# because the tests complete faster and Postgres doesn't choke. It seems
120+
# that macOS's tmpfs is faster than the one on Windows.
121+
NUM_PARALLEL_PACKAGES=8
122+
fi
123+
124+
# We rerun failing tests to counteract flakiness coming from Postgres
125+
# choking on macOS and Windows sometimes.
126+
DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=1000 \
127+
--format standard-quiet --packages "./..." \
128+
-- -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS -count=1
129+
130+
- name: Upload test stats to Datadog
131+
timeout-minutes: 1
132+
continue-on-error: true
133+
uses: ./.github/actions/upload-datadog
134+
if: success() || failure()
135+
with:
136+
api-key: ${{ secrets.DATADOG_API_KEY }}
137+
138+
notify-slack-on-failure:
139+
needs:
140+
- test-go-pg
141+
runs-on: ubuntu-latest
142+
if: failure() && github.ref == 'refs/heads/main'
143+
144+
steps:
145+
- name: Send Slack notification
146+
run: |
147+
curl -X POST -H 'Content-type: application/json' \
148+
--data '{
149+
"blocks": [
150+
{
151+
"type": "header",
152+
"text": {
153+
"type": "plain_text",
154+
"text": "❌ Nightly gauntlet failed",
155+
"emoji": true
156+
}
157+
},
158+
{
159+
"type": "section",
160+
"fields": [
161+
{
162+
"type": "mrkdwn",
163+
"text": "*Workflow:*\n${{ github.workflow }}"
164+
},
165+
{
166+
"type": "mrkdwn",
167+
"text": "*Committer:*\n${{ github.actor }}"
168+
},
169+
{
170+
"type": "mrkdwn",
171+
"text": "*Commit:*\n${{ github.sha }}"
172+
}
173+
]
174+
},
175+
{
176+
"type": "section",
177+
"text": {
178+
"type": "mrkdwn",
179+
"text": "*View failure:* <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here>"
180+
}
181+
}
182+
]
183+
}' ${{ secrets.CI_FAILURE_SLACK_WEBHOOK }}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy