@@ -383,7 +383,12 @@ jobs:
383
383
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
384
384
fi
385
385
export TS_DEBUG_DISCO=true
386
- gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" --rerun-fails=2 \
386
+ TEST_RETRIES="--rerun-fails=2"
387
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
388
+ # on main, run tests without retries
389
+ TEST_RETRIES=""
390
+ fi
391
+ gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" $TEST_RETRIES \
387
392
--packages="./..." -- $PARALLEL_FLAG -short
388
393
389
394
- name : Upload Test Cache
@@ -558,16 +563,20 @@ jobs:
558
563
TESTCOUNT="-count=1"
559
564
fi
560
565
566
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-max-failures=50"
567
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
568
+ # on main, run tests without retries
569
+ TEST_RETRIES=""
570
+ fi
571
+
561
572
mkdir -p "$RUNNER_TEMP/sym"
562
573
source scripts/normalize_path.sh
563
574
# terraform gets installed in a random directory, so we need to normalize
564
575
# the path to the terraform binary or a bunch of cached tests will be
565
576
# invalidated. See scripts/normalize_path.sh for more details.
566
577
normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))"
567
578
568
- # We rerun failing tests to counteract flakiness coming from Postgres
569
- # choking on macOS and Windows sometimes.
570
- DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=50 \
579
+ DB=ci gotestsum $TEST_RETRIES \
571
580
--format standard-quiet --packages "./..." \
572
581
-- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
573
582
@@ -638,8 +647,12 @@ jobs:
638
647
env :
639
648
POSTGRES_VERSION : " 17"
640
649
TS_DEBUG_DISCO : " true"
641
- TEST_RETRIES : 2
642
650
run : |
651
+ export TEST_RETRIES="2"
652
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
653
+ # on main, run tests without retries
654
+ export TEST_RETRIES=""
655
+ fi
643
656
make test-postgres
644
657
645
658
- name : Upload Test Cache
@@ -689,7 +702,12 @@ jobs:
689
702
# c.f. discussion on https://github.com/coder/coder/pull/15106
690
703
- name : Run Tests
691
704
run : |
692
- gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
705
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
706
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
707
+ # on main, run tests without retries
708
+ TEST_RETRIES=""
709
+ fi
710
+ gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
693
711
694
712
- name : Upload Test Cache
695
713
uses : ./.github/actions/test-cache/upload
@@ -740,8 +758,13 @@ jobs:
740
758
env :
741
759
POSTGRES_VERSION : " 17"
742
760
run : |
761
+ TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
762
+ if [ "${{ github.ref }}" == "refs/heads/main" ]; then
763
+ # on main, run tests without retries
764
+ TEST_RETRIES=""
765
+ fi
743
766
make test-postgres-docker
744
- DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
767
+ DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
745
768
746
769
- name : Upload Test Cache
747
770
uses : ./.github/actions/test-cache/upload
@@ -867,13 +890,19 @@ jobs:
867
890
working-directory : site
868
891
869
892
# Run all of the tests with a premium license
870
- - run : pnpm playwright:test --forbid-only --workers 1
893
+ - name : Run Tests with Premium License
894
+ run : |
895
+ # Only retry on PRs, not on main
896
+ if [ "${{ github.ref }}" != "refs/heads/main" ]; then
897
+ export CODER_E2E_TEST_RETRIES=2
898
+ fi
899
+ pnpm playwright:test --forbid-only --workers 1
900
+ shell : bash
871
901
if : ${{ matrix.variant.premium }}
872
902
env :
873
903
DEBUG : pw:api
874
904
CODER_E2E_LICENSE : ${{ secrets.CODER_E2E_LICENSE }}
875
905
CODER_E2E_REQUIRE_PREMIUM_TESTS : " 1"
876
- CODER_E2E_TEST_RETRIES : 2
877
906
working-directory : site
878
907
879
908
- name : Upload Playwright Failed Tests
0 commit comments