Skip to content

Commit 83301c4

Browse files
committed
disable test retries on main
1 parent bf0271f commit 83301c4

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

.github/workflows/ci.yaml

Lines changed: 37 additions & 9 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
@@ -558,16 +563,20 @@ jobs:
558563
TESTCOUNT="-count=1"
559564
fi
560565
566+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-max-failures=50"
567+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
568+
# on main, run tests without retries
569+
TEST_RETRIES=""
570+
fi
571+
561572
mkdir -p "$RUNNER_TEMP/sym"
562573
source scripts/normalize_path.sh
563574
# terraform gets installed in a random directory, so we need to normalize
564575
# the path to the terraform binary or a bunch of cached tests will be
565576
# invalidated. See scripts/normalize_path.sh for more details.
566577
normalize_path_with_symlinks "$RUNNER_TEMP/sym" "$(dirname $(which terraform))"
567578
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 \
571580
--format standard-quiet --packages "./..." \
572581
-- -timeout=20m -v -p $NUM_PARALLEL_PACKAGES -parallel=$NUM_PARALLEL_TESTS $TESTCOUNT
573582
@@ -638,8 +647,12 @@ jobs:
638647
env:
639648
POSTGRES_VERSION: "17"
640649
TS_DEBUG_DISCO: "true"
641-
TEST_RETRIES: 2
642650
run: |
651+
export TEST_RETRIES="2"
652+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
653+
# on main, run tests without retries
654+
export TEST_RETRIES=""
655+
fi
643656
make test-postgres
644657
645658
- name: Upload Test Cache
@@ -689,7 +702,12 @@ jobs:
689702
# c.f. discussion on https://github.com/coder/coder/pull/15106
690703
- name: Run Tests
691704
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/hugodutka/disable-test-retries-on-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
693711
694712
- name: Upload Test Cache
695713
uses: ./.github/actions/test-cache/upload
@@ -740,8 +758,13 @@ jobs:
740758
env:
741759
POSTGRES_VERSION: "17"
742760
run: |
761+
TEST_RETRIES="--rerun-fails=2 --rerun-fails-abort-on-data-race"
762+
if [ "${{ github.ref }}" == "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
763+
# on main, run tests without retries
764+
TEST_RETRIES=""
765+
fi
743766
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
745768
746769
- name: Upload Test Cache
747770
uses: ./.github/actions/test-cache/upload
@@ -867,13 +890,18 @@ jobs:
867890
working-directory: site
868891

869892
# Run all of the tests with a premium license
870-
- run: pnpm playwright:test --forbid-only --workers 1
893+
- run: |
894+
# Only retry on PRs, not on main
895+
if [ "${{ github.ref }}" != "refs/heads/hugodutka/disable-test-retries-on-main" ]; then
896+
export CODER_E2E_TEST_RETRIES=2
897+
fi
898+
pnpm playwright:test --forbid-only --workers 1
899+
shell: bash
871900
if: ${{ matrix.variant.premium }}
872901
env:
873902
DEBUG: pw:api
874903
CODER_E2E_LICENSE: ${{ secrets.CODER_E2E_LICENSE }}
875904
CODER_E2E_REQUIRE_PREMIUM_TESTS: "1"
876-
CODER_E2E_TEST_RETRIES: 2
877905
working-directory: site
878906
879907
- name: Upload Playwright Failed Tests

0 commit comments

Comments
 (0)