diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9ae0a8392f94..852b940228fb 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -57,7 +57,7 @@ jobs: TEST_ALL_PACKAGES: ${{ steps.check-label.outputs.is_full_run }} run: | if [ -n "$TARGET_BRANCH" ]; then - git fetch origin "$TARGET_BRANCH" --deepen=200 || true + git fetch --no-tags --quiet origin "$TARGET_BRANCH" --deepen=200 || true fi python3 ci/get_package_shards.py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 0b5df0687e57..89df3022e2b3 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -74,7 +74,7 @@ jobs: PACKAGE_WEIGHTS: ${{ env.PACKAGE_WEIGHTS }} run: | if [ -n "$TARGET_BRANCH" ]; then - git fetch origin "$TARGET_BRANCH" --depth=1 || true + git fetch --no-tags --quiet origin "$TARGET_BRANCH" --depth=1 || true fi python3 ci/get_package_shards.py diff --git a/ci/run_conditional_tests.sh b/ci/run_conditional_tests.sh index 36f2af877db7..34f401aaa22f 100755 --- a/ci/run_conditional_tests.sh +++ b/ci/run_conditional_tests.sh @@ -55,9 +55,9 @@ elif [[ ${BUILD_TYPE} == "presubmit" ]]; then # common commit in the target branch. if [ -n "${TARGET_BRANCH}" ]; then if [[ "${TEST_TYPE}" == "import_profile" ]]; then - git fetch origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" || true + git fetch --no-tags --quiet origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" || true else - git fetch origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" --depth=200 || true + git fetch --no-tags --quiet origin "${TARGET_BRANCH}:refs/remotes/origin/${TARGET_BRANCH}" --depth=200 || true fi fi GIT_DIFF_ARG="origin/${TARGET_BRANCH}..." @@ -78,21 +78,34 @@ run_test_in_dir() { local log_file="/tmp/test_log_${PY_VERSION}_${pkg_name_clean}.log" export COVERAGE_FILE="${PROJECT_ROOT}/.coverage.${PY_VERSION}.${pkg_name_clean}" + echo "============================================================" + echo "Starting tests in ${d}" + echo "============================================================" + pushd ${d} > /dev/null set +e - ${test_script} > "${log_file}" 2>&1 - local ret=$? + if [ "${PARALLEL_WORKERS}" = "1" ]; then + # When running with a single worker, stream output in real-time while capturing to log file + ${test_script} 2>&1 | tee "${log_file}" + local ret=${PIPESTATUS[0]} + else + # When running multiple workers in parallel, buffer output to prevent interleaved log lines + ${test_script} > "${log_file}" 2>&1 + local ret=$? + echo "============================================================" + echo "Finished tests in ${d} (exit code: ${ret})" + echo "============================================================" + cat "${log_file}" + fi set -e popd > /dev/null - - echo "============================================================" - echo "Running tests in ${d}" - echo "============================================================" - cat "${log_file}" rm -f "${log_file}" if [ ${ret} -ne 0 ]; then - exit ${ret} + echo "❌ Tests failed in ${d} with exit code ${ret}" + exit 255 # Cancel xargs parallel jobs + else + echo "✅ Tests passed in ${d}" fi } export -f run_test_in_dir diff --git a/ci/run_single_test.sh b/ci/run_single_test.sh index 514cc5c2b16e..0ea0b969770d 100755 --- a/ci/run_single_test.sh +++ b/ci/run_single_test.sh @@ -71,28 +71,28 @@ case ${TEST_TYPE} in unit) case ${PY_VERSION} in "3.10") - nox -s unit-3.10 + nox --stop-on-first-error -s unit-3.10 retval=$? ;; "3.11") - nox -s unit-3.11 + nox --stop-on-first-error -s unit-3.11 retval=$? ;; "3.12") - nox -s unit-3.12 + nox --stop-on-first-error -s unit-3.12 retval=$? ;; "3.13") - nox -s unit-3.13 + nox --stop-on-first-error -s unit-3.13 retval=$? ;; "3.14") - nox -s unit-3.14 + nox --stop-on-first-error -s unit-3.14 retval=$? ;; "3.15") # This is needed to speed up builds - nox --force-venv-backend uv -s unit-3.15 + nox --stop-on-first-error --force-venv-backend uv -s unit-3.15 retval=$? ;; *) @@ -212,7 +212,7 @@ case ${TEST_TYPE} in fi ;; *) - nox -s ${TEST_TYPE} + nox --stop-on-first-error -s ${TEST_TYPE} retval=$? ;; esac