Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
use a temporary folder on the D: drive in Windows CI for postgres
  • Loading branch information
hugodutka committed Dec 2, 2024
commit 988c8935a2101c42c23f6a720be3d161c956e0bc
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,12 @@ jobs:

if [ "${{ runner.os }}" == "Linux" ]; then
make test-postgres
elif [ "${{ runner.os }}" == "Windows" ]; then
# Create temp dir on D: drive for Windows. The default C: drive is extremely
# slow: https://github.com/actions/runner-images/issues/8755
mkdir -p "D:/temp/embedded-pg"
go run scripts/embedded-pg/main.go -path "D:/temp/embedded-pg"
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
else
go run scripts/embedded-pg/main.go
DB=ci gotestsum --format standard-quiet -- -v -short -count=1 ./...
Expand Down
9 changes: 9 additions & 0 deletions scripts/embedded-pg/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,23 @@ package main

import (
"database/sql"
"flag"
"os"
"path/filepath"

embeddedpostgres "github.com/fergusstrange/embedded-postgres"
)

func main() {
var customPath string
flag.StringVar(&customPath, "path", "", "Optional custom path for postgres data directory")
flag.Parse()

postgresPath := filepath.Join(os.TempDir(), "coder-test-postgres")
if customPath != "" {
postgresPath = customPath
}

ep := embeddedpostgres.NewDatabase(
embeddedpostgres.DefaultConfig().
Version(embeddedpostgres.V16).
Expand Down