Skip to content

Commit 988c893

Browse files
committed
use a temporary folder on the D: drive in Windows CI for postgres
1 parent de40386 commit 988c893

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@ jobs:
426426
427427
if [ "${{ runner.os }}" == "Linux" ]; then
428428
make test-postgres
429+
elif [ "${{ runner.os }}" == "Windows" ]; then
430+
# Create temp dir on D: drive for Windows. The default C: drive is extremely
431+
# slow: https://github.com/actions/runner-images/issues/8755
432+
mkdir -p "D:/temp/embedded-pg"
433+
go run scripts/embedded-pg/main.go -path "D:/temp/embedded-pg"
434+
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
429435
else
430436
go run scripts/embedded-pg/main.go
431437
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...

scripts/embedded-pg/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,23 @@ package main
33

44
import (
55
"database/sql"
6+
"flag"
67
"os"
78
"path/filepath"
89

910
embeddedpostgres "github.com/fergusstrange/embedded-postgres"
1011
)
1112

1213
func main() {
14+
var customPath string
15+
flag.StringVar(&customPath, "path", "", "Optional custom path for postgres data directory")
16+
flag.Parse()
17+
1318
postgresPath := filepath.Join(os.TempDir(), "coder-test-postgres")
19+
if customPath != "" {
20+
postgresPath = customPath
21+
}
22+
1423
ep := embeddedpostgres.NewDatabase(
1524
embeddedpostgres.DefaultConfig().
1625
Version(embeddedpostgres.V16).

0 commit comments

Comments
 (0)