Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf428bc

Browse files
committed
ci
1 parentbd65914 commitdf428bc

File tree

3 files changed

+60
-19
lines changed

3 files changed

+60
-19
lines changed

‎.github/actions/setup-go/action.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,15 @@ runs:
2626
export GOCACHE_DIR="$RUNNER_TEMP""\go-cache"
2727
export GOMODCACHE_DIR="$RUNNER_TEMP""\go-mod-cache"
2828
export GOPATH_DIR="$RUNNER_TEMP""\go-path"
29+
export GOTMP_DIR="$RUNNER_TEMP""\go-tmp"
2930
mkdir -p "$GOCACHE_DIR"
3031
mkdir -p "$GOMODCACHE_DIR"
3132
mkdir -p "$GOPATH_DIR"
33+
mkdir -p "$GOTMP_DIR"
3234
go env -w GOCACHE="$GOCACHE_DIR"
3335
go env -w GOMODCACHE="$GOMODCACHE_DIR"
3436
go env -w GOPATH="$GOPATH_DIR"
35-
37+
go env -w GOTMPDIR="$GOTMP_DIR"
3638
-name:Setup Go
3739
uses:actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32# v5.0.2
3840
with:

‎.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ jobs:
454454
api-key:${{ secrets.DATADOG_API_KEY }}
455455

456456
test-go-pg:
457-
runs-on:${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-4' || matrix.os }}
457+
runs-on:${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || matrix.os }}
458458
needs:changes
459459
if:needs.changes.outputs.go == 'true' || needs.changes.outputs.ci == 'true' || github.ref == 'refs/heads/main'
460460
# This timeout must be greater than the timeout set by `go test` in

‎.github/workflows/nightly-gauntlet.yaml

Lines changed: 56 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ permissions:
1212

1313
jobs:
1414
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'
15+
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 }}
1716
# This timeout must be greater than the timeout set by `go test` in
1817
# `make test-postgres` to ensure we receive a trace of running
1918
# goroutines. Setting this to the timeout +5m should work quite well
@@ -31,22 +30,39 @@ jobs:
3130
with:
3231
egress-policy:audit
3332

33+
# macOS indexes all new files in the background. Our Postgres tests
34+
# create and destroy thousands of databases on disk, and Spotlight
35+
# tries to index all of them, seriously slowing down the tests.
36+
-name:Disable Spotlight Indexing
37+
if:runner.os == 'macOS'
38+
run:|
39+
sudo mdutil -a -i off
40+
sudo mdutil -X /
41+
sudo launchctl bootout system /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
42+
43+
# Set up RAM disks to speed up the rest of the job. This action is in
44+
# a separate repository to allow its use before actions/checkout.
45+
-name:Setup RAM Disks
46+
if:runner.os == 'Windows'
47+
uses:coder/setup-ramdisk-action@79dacfe70c47ad6d6c0dd7f45412368802641439
48+
3449
-name:Checkout
3550
uses:actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683# v4.2.2
3651
with:
3752
fetch-depth:1
3853

3954
-name:Setup Go
4055
uses:./.github/actions/setup-go
56+
with:
57+
# Runners have Go baked-in and Go will automatically
58+
# download the toolchain configured in go.mod, so we don't
59+
# need to reinstall it. It's faster on Windows runners.
60+
use-preinstalled-go:${{ runner.os == 'Windows' }}
61+
use-temp-cache-dirs:${{ runner.os == 'Windows' }}
4162

4263
-name:Setup Terraform
4364
uses:./.github/actions/setup-tf
4465

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-
5066
-name:Test with PostgreSQL Database
5167
env:
5268
POSTGRES_VERSION:"13"
@@ -55,6 +71,19 @@ jobs:
5571
LC_ALL:"en_US.UTF-8"
5672
shell:bash
5773
run:|
74+
if [ "${{ runner.os }}" == "Windows" ]; then
75+
# Create a temp dir on the R: ramdisk drive for Windows. The default
76+
# C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
77+
mkdir -p "R:/temp/embedded-pg"
78+
go run scripts/embedded-pg/main.go -path "R:/temp/embedded-pg"
79+
fi
80+
if [ "${{ runner.os }}" == "macOS" ]; then
81+
# Postgres runs faster on a ramdisk on macOS too
82+
mkdir -p /tmp/tmpfs
83+
sudo mount_tmpfs -o noowners -s 8g /tmp/tmpfs
84+
go run scripts/embedded-pg/main.go -path /tmp/tmpfs/embedded-pg
85+
fi
86+
5887
# if macOS, install google-chrome for scaletests
5988
# As another concern, should we really have this kind of external dependency
6089
# requirement on standard CI?
@@ -72,19 +101,29 @@ jobs:
72101
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
73102
fi
74103
104+
# Golang's default for these 2 variables is the number of logical CPUs.
105+
# Our Windows and Linux runners have 16 cores, so they match up there.
106+
NUM_PARALLEL_PACKAGES=16
107+
NUM_PARALLEL_TESTS=16
75108
if [ "${{ runner.os }}" == "Windows" ]; then
76-
# Create a temp dir on the R: ramdisk drive for Windows. The default
77-
# C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
78-
mkdir -p "R:/temp/embedded-pg"
79-
go run scripts/embedded-pg/main.go -path "R:/temp/embedded-pg"
80-
else
81-
go run scripts/embedded-pg/main.go
109+
# On Windows Postgres chokes up when we have more 16x16=256 tests
110+
# running in parallel, and dbtestutil.NewDB starts to take more than
111+
# 10s to complete sometimes causing test timeouts. With 16x8=128 tests
112+
# Postgres tends not to choke.
113+
NUM_PARALLEL_PACKAGES=8
114+
fi
115+
if [ "${{ runner.os }}" == "macOS" ]; then
116+
# Our macOS runners have 8 cores. We leave NUM_PARALLEL_TESTS at 16
117+
# because the tests complete faster and Postgres doesn't choke. It seems
118+
# that macOS's tmpfs is faster than the one on Windows.
119+
NUM_PARALLEL_PACKAGES=8
82120
fi
83121
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 ./...
122+
# We rerun failing tests to counteract flakiness coming from Postgres
123+
# choking on macOS and Windows sometimes.
124+
DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=1000 \
125+
--format standard-quiet --packages "./..." \
126+
-- -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS -count=1
88127
89128
-name:Upload test stats to Datadog
90129
timeout-minutes:1

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp