Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c635699

Browse files
committed
disable test retries on main
1 parent c95d972 commit c635699

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,12 @@ jobs:
383383
touch ~/.bash_profile && echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile
384384
fi
385385
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/hugodutka/disable-test-retries-on-main" ]; then
388+
# on main, run tests without retries
389+
TEST_RETRIES=""
390+
fi
391+
gotestsum --junitfile="gotests.xml" --jsonfile="gotests.json" $TEST_RETRIES \
387392
--packages="./..." -- $PARALLEL_FLAG -short
388393
389394
- name: Upload Test Cache
@@ -547,16 +552,20 @@ jobs:
547552
TESTCOUNT="-count=1"
548553
fi
549554
555+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-max-failures=50"
556+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
557+
# on main, run tests without retries
558+
TEST_RETRIES=""
559+
fi
560+
550561
mkdir -p "$RUNNER_TEMP/sym"
551562
source scripts/normalize_path.sh
552563
# terraform gets installed in a random directory, so we need to normalize
553564
# the path to the terraform binary or a bunch of cached tests will be
554565
# invalidated. See scripts/normalize_path.sh for more details.
555566
normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))"
556567
557-
# We rerun failing tests to counteract flakiness coming from Postgres
558-
# choking on macOS and Windows sometimes.
559-
DB=ci gotestsum --rerun-fails=2 --rerun-fails-max-failures=50 \
568+
DB=ci gotestsum $TEST_RETRIES \
560569
--format standard-quiet --packages "./..." \
561570
-- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
562571
@@ -619,7 +628,8 @@ jobs:
619628
env:
620629
POSTGRES_VERSION: "17"
621630
TS_DEBUG_DISCO: "true"
622-
TEST_RETRIES: 2
631+
# on main, run tests without retries
632+
TEST_RETRIES: "{{ github.ref == 'refs/heads/hugodutka/disable-test-retries-on-main' && '' || '2' }}"
623633
run: |
624634
make test-postgres
625635
@@ -670,7 +680,12 @@ jobs:
670680
# c.f. discussion on https://github.com/coder/coder/pull/15106
671681
- name: Run Tests
672682
run: |
673-
gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
683+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
684+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
685+
# on main, run tests without retries
686+
TEST_RETRIES=""
687+
fi
688+
gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
674689
675690
- name: Upload Test Cache
676691
uses: ./.github/actions/test-cache/upload
@@ -721,8 +736,13 @@ jobs:
721736
env:
722737
POSTGRES_VERSION: "17"
723738
run: |
739+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
740+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
741+
# on main, run tests without retries
742+
TEST_RETRIES=""
743+
fi
724744
make test-postgres-docker
725-
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
745+
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
726746
727747
- name: Upload Test Cache
728748
uses: ./.github/actions/test-cache/upload

0 commit comments

Comments
 (0)