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