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

Skip to content

Commit dff0649

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

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

.github/workflows/ci.yaml

Lines changed: 30 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,8 +628,12 @@ jobs:
619628
env:
620629
POSTGRES_VERSION: "17"
621630
TS_DEBUG_DISCO: "true"
622-
TEST_RETRIES: 2
623631
run: |
632+
export TEST_RETRIES="2"
633+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
634+
# on main, run tests without retries
635+
export TEST_RETRIES=""
636+
fi
624637
make test-postgres
625638
626639
- name: Upload Test Cache
@@ -670,7 +683,12 @@ jobs:
670683
# c.f. discussion on https://github.com/coder/coder/pull/15106
671684
- name: Run Tests
672685
run: |
673-
gotestsum --junitfile="gotests.xml" --packages="./..." --rerun-fails=2 --rerun-fails-abort-on-data-race -- -race -parallel 4 -p 4
686+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
687+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
688+
# on main, run tests without retries
689+
TEST_RETRIES=""
690+
fi
691+
gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
674692
675693
- name: Upload Test Cache
676694
uses: ./.github/actions/test-cache/upload
@@ -721,8 +739,13 @@ jobs:
721739
env:
722740
POSTGRES_VERSION: "17"
723741
run: |
742+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
743+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
744+
# on main, run tests without retries
745+
TEST_RETRIES=""
746+
fi
724747
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
748+
DB=ci gotestsum --junitfile="gotests.xml" --packages="./..." $TEST_RETRIES -- -race -parallel 4 -p 4
726749
727750
- name: Upload Test Cache
728751
uses: ./.github/actions/test-cache/upload

0 commit comments

Comments
 (0)