@@ -490,21 +490,33 @@ jobs:
490
490
# a separate repository to allow its use before actions/checkout.
491
491
- name : Setup RAM Disks
492
492
if : runner.os == 'Windows'
493
- uses : coder/setup-ramdisk-action@79dacfe70c47ad6d6c0dd7f45412368802641439
493
+ uses : coder/setup-ramdisk-action@417abac44189f3f234f4fd6dd8c1ddcc8c3acd5e
494
494
495
495
- name : Checkout
496
496
uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
497
497
with :
498
498
fetch-depth : 1
499
499
500
+ - name : Setup Go Paths
501
+ id : go-paths
502
+ uses : ./.github/actions/setup-go-paths
503
+
504
+ - name : Download Go Build Cache
505
+ id : download-go-build-cache
506
+ uses : ./.github/actions/test-cache/download
507
+ with :
508
+ key-prefix : test-go-build-pr4-${{ runner.os }}-${{ runner.arch }}
509
+ cache-path : ${{ steps.go-paths.outputs.cached-dirs }}
510
+
500
511
- name : Setup Go
512
+ id : setup-go
501
513
uses : ./.github/actions/setup-go
502
514
with :
503
515
# Runners have Go baked-in and Go will automatically
504
516
# download the toolchain configured in go.mod, so we don't
505
517
# need to reinstall it. It's faster on Windows runners.
506
518
use-preinstalled-go : ${{ runner.os == 'Windows' }}
507
- use-temp- cache-dirs : ${{ runner.os == 'Windows' }}
519
+ use-cache : false
508
520
509
521
- name : Setup Terraform
510
522
uses : ./.github/actions/setup-tf
@@ -515,14 +527,24 @@ jobs:
515
527
with :
516
528
key-prefix : test-go-pg-${{ runner.os }}-${{ runner.arch }}
517
529
530
+ - name : Normalize File and Directory Timestamps
531
+ shell : bash
532
+ run : |
533
+ find . -type f ! -path ./.git/\*\* | mtimehash
534
+ find . -type d ! -path ./.git/\*\* -exec touch -t 200601010000 {} +
535
+
518
536
- name : Test with PostgreSQL Database
519
537
env :
520
538
POSTGRES_VERSION : " 13"
521
539
TS_DEBUG_DISCO : " true"
522
540
LC_CTYPE : " en_US.UTF-8"
523
541
LC_ALL : " en_US.UTF-8"
542
+
524
543
shell : bash
525
544
run : |
545
+ set -o errexit
546
+ set -o pipefail
547
+
526
548
if [ "${{ runner.os }}" == "Windows" ]; then
527
549
# Create a temp dir on the R: ramdisk drive for Windows. The default
528
550
# C: drive is extremely slow: https://github.com/actions/runner-images/issues/8755
@@ -533,6 +555,8 @@ jobs:
533
555
mkdir -p /tmp/tmpfs
534
556
sudo mount_tmpfs -o noowners -s 8g /tmp/tmpfs
535
557
go run scripts/embedded-pg/main.go -path /tmp/tmpfs/embedded-pg
558
+ elif [ "${{ runner.os }}" == "Linux" ]; then
559
+ make test-postgres-docker
536
560
fi
537
561
538
562
# if macOS, install google-chrome for scaletests
@@ -542,10 +566,6 @@ jobs:
542
566
brew install google-chrome
543
567
fi
544
568
545
- # By default Go will use the number of logical CPUs, which
546
- # is a fine default.
547
- PARALLEL_FLAG=""
548
-
549
569
# macOS will output "The default interactive shell is now zsh"
550
570
# intermittently in CI...
551
571
if [ "${{ matrix.os }}" == "macos-latest" ]; then
@@ -572,16 +592,33 @@ jobs:
572
592
NUM_PARALLEL_TESTS=8
573
593
fi
574
594
575
- if [ "${{ runner.os }}" == "Linux" ]; then
576
- make test-postgres
577
- else
578
- # We rerun failing tests to counteract flakiness coming from Postgres
579
- # choking on macOS and Windows sometimes.
580
- DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=50 \
581
- --format standard-quiet --packages "./..." \
582
- -- -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS -count=1
595
+ # by default, run tests with cache
596
+ TESTCOUNT=""
597
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
598
+ # on main, run tests without cache
599
+ TESTCOUNT="-count=1"
583
600
fi
584
601
602
+ # see scripts/normalize_path.sh for why we need this
603
+ mkdir -p "$RUNNER_TEMP/sym"
604
+ source scripts/normalize_path.sh
605
+ export DIR_PREFIX="$(dirname $(which terraform))"
606
+ normalize_path_with_symlinks "$RUNNER_TEMP/sym"
607
+
608
+ # We rerun failing tests to counteract flakiness coming from Postgres
609
+ # choking on macOS and Windows sometimes.
610
+ # TODO: for testing purposes we're only running the agent tests.
611
+ # THIS MUST BE REVERTED BEFORE MERGING.
612
+ DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=50 \
613
+ --format standard-quiet --packages "./agent/..." \
614
+ -- -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
615
+
616
+ - name : Upload Go Build Cache
617
+ uses : ./.github/actions/test-cache/upload
618
+ with :
619
+ cache-key : ${{ steps.download-go-build-cache.outputs.cache-key }}
620
+ cache-path : ${{ steps.go-paths.outputs.cached-dirs }}
621
+
585
622
- name : Upload Test Cache
586
623
uses : ./.github/actions/test-cache/upload
587
624
with :
0 commit comments